aboutsummaryrefslogtreecommitdiffstats
path: root/worktree_status.go
diff options
context:
space:
mode:
authorNicholas openSUSE Software Engineer <nicholas.paolillo@suse.com>2024-08-06 13:30:19 -0300
committerGitHub <noreply@github.com>2024-08-06 17:30:19 +0100
commitdb559f123697163815f91801a4ed31d9b36be4f3 (patch)
treef20ec4a279e8952cd74a71ce1c0239fa637b4f77 /worktree_status.go
parentb430952cb0898cbfad479375a781fce6142f9c61 (diff)
downloadgo-git-db559f123697163815f91801a4ed31d9b36be4f3.tar.gz
plumbing: filemode, Remove check for setting size of .git/index file (#1159)
* plumbing: filemode, Remove check for setting size of .git/index file on staging. Fixes #1003 Co-authored-by: Paulo Gomes <paulo.gomes.uk@gmail.com>
Diffstat (limited to 'worktree_status.go')
-rw-r--r--worktree_status.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/worktree_status.go b/worktree_status.go
index 6a0049c..f6b8282 100644
--- a/worktree_status.go
+++ b/worktree_status.go
@@ -559,9 +559,11 @@ func (w *Worktree) doUpdateFileToIndex(e *index.Entry, filename string, h plumbi
return err
}
- if e.Mode.IsRegular() {
- e.Size = uint32(info.Size())
- }
+ // The entry size must always reflect the current state, otherwise
+ // it will cause go-git's Worktree.Status() to divert from "git status".
+ // The size of a symlink is the length of the path to the target.
+ // The size of Regular and Executable files is the size of the files.
+ e.Size = uint32(info.Size())
fillSystemInfo(e, info.Sys())
return nil