threads / discuss / 32586

Suggestion: add option in git-p4 to preserve user in Git repository

Subject: Suggestion: add option in git-p4 to preserve user in Git repository

## tl;dr

6 messages between Jan 11, 2013 and Jun 17, 2013.

replies: 5people: 3as markdown or json

Olivier Delalleau· Jan 11, 2013, 03:38 UTC · lore
Hi,

I'm in a situation where I don't have P4 admin rights to use the --preserve-user option of git-p4. However, I would like to keep user information in the associated Git branch.

Would it be possible to add an option for this?
Thanks,
-=- Olivier
Pete Wyckoff· Jan 12, 2013, 16:38 UTC · re: Olivier Delalleau · lore

Re: Suggestion: add option in git-p4 to preserve user in Git repository

shish@keba.be wrote on Thu, 10 Jan 2013 22:38 -0500:
Show 5 quoted lines
> I'm in a situation where I don't have P4 admin rights to use the
> --preserve-user option of git-p4. However, I would like to keep user
> information in the associated Git branch.
> 
> Would it be possible to add an option for this?

The --preserve-user option is used to submit somebody else's work from git to p4. It does "p4 change -f" to edit the author of the change after it has been submitted to p4. P4 requires admin privileges to do that.

Changes that are imported _from_ p4 to git do have the correct author information.

Can you explain a bit more what you're looking for?
		-- Pete
Olivier Delalleau· Jan 12, 2013, 19:44 UTC · re: Pete Wyckoff · lore

Re: Suggestion: add option in git-p4 to preserve user in Git repository

2013/1/12 Pete Wyckoff <pw@padd.com>:
Show 18 quoted lines
> shish@keba.be wrote on Thu, 10 Jan 2013 22:38 -0500:
>> I'm in a situation where I don't have P4 admin rights to use the
>> --preserve-user option of git-p4. However, I would like to keep user
>> information in the associated Git branch.
>>
>> Would it be possible to add an option for this?
>
> The --preserve-user option is used to submit somebody else's work
> from git to p4.  It does "p4 change -f" to edit the author of the
> change after it has been submitted to p4.  P4 requires admin
> privileges to do that.
>
> Changes that are imported _from_ p4 to git do have the correct
> author information.
>
> Can you explain a bit more what you're looking for?
>
>                 -- Pete
Hi,

Sorry I wasn't clear enough. When "git p4 submit" submits changes from Git to P4, it also edits the Git history and replaces the Git commits' authors by the information from the Perforce account submitting the changes. The advantage is that both the P4 and Git repositories share the same author information, but in my case I would like to keep in the Git repository the original authors (because the P4 account I'm using to submit to P4 is shared by all Git users).

Hope it makes more sense now :)
-=- Olivier
Pete Wyckoff· Jan 12, 2013, 22:56 UTC · re: Olivier Delalleau · lore

Re: Suggestion: add option in git-p4 to preserve user in Git repository

shish@keba.be wrote on Sat, 12 Jan 2013 14:44 -0500:
Show 25 quoted lines
> 2013/1/12 Pete Wyckoff <pw@padd.com>:
> > shish@keba.be wrote on Thu, 10 Jan 2013 22:38 -0500:
> >> I'm in a situation where I don't have P4 admin rights to use the
> >> --preserve-user option of git-p4. However, I would like to keep user
> >> information in the associated Git branch.
> >>
> >> Would it be possible to add an option for this?
> >
> > The --preserve-user option is used to submit somebody else's work
> > from git to p4.  It does "p4 change -f" to edit the author of the
> > change after it has been submitted to p4.  P4 requires admin
> > privileges to do that.
> >
> > Changes that are imported _from_ p4 to git do have the correct
> > author information.
> >
> > Can you explain a bit more what you're looking for?
> 
> Sorry I wasn't clear enough. When "git p4 submit" submits changes from
> Git to P4, it also edits the Git history and replaces the Git commits'
> authors by the information from the Perforce account submitting the
> changes. The advantage is that both the P4 and Git repositories share
> the same author information, but in my case I would like to keep in
> the Git repository the original authors (because the P4 account I'm
> using to submit to P4 is shared by all Git users).

Ah, I see what you're looking for now. It's certainly possible to keep a mapping in the git side to remember who really wrote each change that went into p4, but there's nothing set up to do that now. And it would be a fair amount of work, with many little details.

You could put the true name in the commit message, like we do signed-off-by messages: "Author: Real Coder <rc@my.com>". That would keep the proper attribution, but not work with "git log --author", e.g.; you'd have to use "--grep='Real Coder'" instead.

		-- Pete
Olivier Delalleau· Jan 13, 2013, 04:56 UTC · re: Pete Wyckoff · lore

Re: Suggestion: add option in git-p4 to preserve user in Git repository

2013/1/12 Pete Wyckoff <pw@padd.com>:
Show 38 quoted lines
> shish@keba.be wrote on Sat, 12 Jan 2013 14:44 -0500:
>> 2013/1/12 Pete Wyckoff <pw@padd.com>:
>> > shish@keba.be wrote on Thu, 10 Jan 2013 22:38 -0500:
>> >> I'm in a situation where I don't have P4 admin rights to use the
>> >> --preserve-user option of git-p4. However, I would like to keep user
>> >> information in the associated Git branch.
>> >>
>> >> Would it be possible to add an option for this?
>> >
>> > The --preserve-user option is used to submit somebody else's work
>> > from git to p4.  It does "p4 change -f" to edit the author of the
>> > change after it has been submitted to p4.  P4 requires admin
>> > privileges to do that.
>> >
>> > Changes that are imported _from_ p4 to git do have the correct
>> > author information.
>> >
>> > Can you explain a bit more what you're looking for?
>>
>> Sorry I wasn't clear enough. When "git p4 submit" submits changes from
>> Git to P4, it also edits the Git history and replaces the Git commits'
>> authors by the information from the Perforce account submitting the
>> changes. The advantage is that both the P4 and Git repositories share
>> the same author information, but in my case I would like to keep in
>> the Git repository the original authors (because the P4 account I'm
>> using to submit to P4 is shared by all Git users).
>
> Ah, I see what you're looking for now.  It's certainly possible
> to keep a mapping in the git side to remember who really wrote
> each change that went into p4, but there's nothing set up to do
> that now.  And it would be a fair amount of work, with many
> little details.
>
> You could put the true name in the commit message, like
> we do signed-off-by messages: "Author: Real Coder <rc@my.com>".
> That would keep the proper attribution, but not work with "git
> log --author", e.g.; you'd have to use "--grep='Real Coder'"
> instead.

Ok, thanks. I actually manage to hack my way around it, restoring the author information with "git filter-branch" and overriding the remote p4 tracking branch with "git update-ref". Did some limited testing and it seems to work -- hopefully I won't have nasty surprises down the road ;)

-=- Olivier

← back to recent threads