git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] blame: Allow to blame paths freshly added to the index

From
Junio C Hamano <gitster@pobox.com>
Date
Jul 15, 2016, 21:14 UTC
Message-ID
<xmqqr3auli2x.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<xmqqvb06lita.fsf@gitster.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
Show 23 quoted lines
> I suspect that the above change needs to be updated further if the
> user wants to run "blame path" during a conflicted renaming merge,
> i.e.
>
>  0. Before two histories diverged, there was old_path.
>  1. Our side updated contents of that file and kept it at old_path.
>  2. Their side updated contents of that file and moved it to path.
>  3. "git merge" notcied the rename, created three stages at "path",
>     with the result of conflicted content-level merge in the working
>     tree at "path".
>  4. The user edits "path" and resolves the conflict, but wants to
>     double check before running "git add path".
>  5. "git blame path"
>
> Perhaps something like this should suffice:
>
>     pos = cache_name_pos(path, strlen(path));
>     if (0 <= pos)
>     	; /* ok */
>     else if (!strcmp(active_cache[-1 - pos]->name), path)
>         ; /* ok -- just unmerged */
>     else
>     	die("no such path in HEAD");

I do not think the "conflicted renaming merge" example would not be a problem in practice iff "git merge" was used, because the fake working tree commit would look at both our tree and their tree, and find "path" in theirs inside the loop above this "die".

But the user can be in the same conflicted rename situation with "git am -3" or cherry-pick, and in these cases there won't be extra parent commits for the fake work tree commit, hence the conclusion does not change.

Thanks.
Previous: Junio C HamanoNext: Mike Hommey
Message 9 of 15 in “blame: Allow to blame paths freshly added to the index”
  1. blame: Allow to blame paths freshly added to the indexMike Hommey, Jul 15, 2016
  2. Johannes SchindelinJul 15, 2016
  3. Mike HommeyJul 15, 2016
  4. Jeff KingJul 15, 2016
  5. Mike HommeyJul 15, 2016
  6. blame: Allow to blame paths freshly added to the indexMike Hommey, Jul 15, 2016
  7. Johannes SchindelinJul 15, 2016
  8. Junio C HamanoJul 15, 2016
  9. Junio C HamanoJul 15, 2016
  10. Mike HommeyJul 15, 2016
  11. Junio C HamanoJul 18, 2016
  12. 1/2 blame: Allow to blame paths freshly added to the indexMike Hommey, Jul 15, 2016
  13. 2/2 t/t8003-blame-corner-cases.sh: Use here documentsMike Hommey, Jul 15, 2016
  14. Johannes SchindelinJul 16, 2016
  15. Junio C HamanoJul 18, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.