]> git.ipfire.org Git - thirdparty/git.git/commit - t/t2203-add-intent.sh
wt-status.c: handle worktree renames
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>
Wed, 27 Dec 2017 10:18:39 +0000 (17:18 +0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Dec 2017 20:38:35 +0000 (12:38 -0800)
commit176ea747930908669200520ae14f9dbc61cf0d40
tree38244c873d3d4a9beba07b42d64511853258f750
parent5134ccde642ae9ed6a244c92864c26734d100f4c
wt-status.c: handle worktree renames

Before 425a28e0a4 (diff-lib: allow ita entries treated as "not yet exist
in index" - 2016-10-24) there are never "new files" in the index, which
essentially disables rename detection because we only detect renames
when a new file appears in a diff pair.

After that commit, an i-t-a entry can appear as a new file in "git
diff-files". But the diff callback function in wt-status.c does not
handle this case and produces incorrect status output.

PS. The reader may notice that this patch adds a new xstrdup() but not
a free(). Yes we leak memory (the same for head_path). But wt_status
so far has been short lived, this leak should not matter in
practice.

Noticed-by: Alex Vandiver <alexmv@dropbox.com>
Helped-by: Igor Djordjevic <igor.d.djordjevic@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/git-status.txt
t/t2203-add-intent.sh
wt-status.c