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

Re: [PATCH] Add --unannotate option to git-subtree

From
James Nylen <jnylen@gmail.com>
Date
Jan 17, 2013, 20:56 UTC
Message-ID
<CABVa4NhwcD584ptSazOR9WvSWep1z+krhxkWDvUk8nXaF8EYxQ@mail.gmail.com>
In-Reply-To
<87a9st4sb8.fsf@waller.obbligato.org>
On Mon, Dec 31, 2012 at 8:15 PM,  <greened@obbligato.org> wrote:
Show 31 quoted lines
> James Nylen <jnylen@gmail.com> writes:
>
>> Rather than adding a marker to each commit when splitting out the
>> commits back to the subproject, --unannotate removes the specified
>> string (or bash glob pattern) from the beginning of the first line of
>> the commit message.  This enables the following workflow:
>
> I applied the patch to my working copy but it doesn't seem to do
> what I'd expect.  The test script does something like this:
>
> - create project A
> - add file to project A with message "subproj: add F1"
> - add file to project A with message "subproj: add F2"
> - add project A as a subtree of project B under directory subdir
> - add a file to subdir with message "subproj: add F3"
> - do a split --unannotate="subproj:"
>
> I expected to see a log with no mention of "subproj" anywhere.  Instead
> I get:
>
> add F3
> subproj: add F2
> subproj: add F1
>
> Is this as you intend?  Is --unannotate only supposed to strip the
> string for commits added when A was a subtree of B?
>
> I guess this behavior makes sense in that the user would want to
> see the same commits that existed before A became a subproject.
>
>                    -David

Wow, I missed a bunch of emails on this. Thanks for applying and for writing tests!

This is as intended. You wouldn't want subtree to modify commits that occurred in the full repository for project A. Furthermore, you wouldn't have a "subproj:" commit in project A's standalone repo since it wasn't a subproject at that time.

The --annotate option confused me because it was the reverse of what I wanted. As in your example, a typical use would be 'add a file to subdir with message "subproj: add F3" ' to make it clear that you were committing to the "subproj" part of a larger repository. Then, when splitting back out to subproj's main repository, you'd want to remove the prefix.

Previous: greened@obbligato.orgNext: greened@obbligato.org
Message 6 of 7 in “Add --unannotate option to git-subtree”
  1. Add --unannotate option to git-subtreeJames Nylen, Oct 9, 2012
  2. James NylenOct 16, 2012
  3. Herman van RinkOct 20, 2012
  4. greened@obbligato.orgDec 31, 2012
  5. greened@obbligato.orgJan 1, 2013
  6. James NylenJan 17, 2013
  7. greened@obbligato.orgJan 22, 2013

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.