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

Re: [GSoC][PATCH v2 2/2] rebase -i: support --committer-date-is-author-date

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Jul 24, 2019, 13:33 UTC
Message-ID
<dbe0fe4d-9553-fd8e-5c5a-5457dc5e3eae@gmail.com>
In-Reply-To
<20190723195722.16745-1-rohit.ashiwal265@gmail.com>
Hi Rohit
On 23/07/2019 20:57, Rohit Ashiwal wrote:
Show 34 quoted lines
> Hi Phillip
> 
> On Sat, 20 Jul 2019 15:56:50 +0100 Phillip Wood <phillip.wood123@gmail.com> wrote:
>>
>> [...]
>>
>>> @@ -467,6 +470,9 @@ int cmd_rebase__interactive(int argc, const char **argv, const char *prefix)
>>>    		OPT_BOOL(0, "autosquash", &opts.autosquash,
>>>    			 N_("move commits that begin with squash!/fixup!")),
>>>    		OPT_BOOL(0, "signoff", &opts.signoff, N_("sign commits")),
>>> +		OPT_BOOL(0, "committer-date-is-author-date",
>>> +			 &opts.committer_date_is_author_date,
>>> +			 N_("make committer date match author date")),
>>
>> I guess it's good to do this for completeness but does
>> rebase--preserver-merges.sh support --committer-date-is-author-date? It
>> is the only caller of rebase--interactive I think so would be the only
>> user of this code.
> 
> Oh! Yes, I did it for the completeness. Let's add the flag while we
> still have that _rebase--interactive_ command hanging out with us.
> 
>> [...]
>>
>>> +	if (read_author_script(rebase_path_author_script(),
>>> +			       NULL, NULL, &date, 0))
>>> +		die(_("failed to read author date"));
>>
>> Can we have this return an error please - we try quite hard in the
>> sequencer not to die in library code.
> 
> Yes, we can through an error and continue, but then the user will
> see the unchanged author date which is against his / her will but
> it will not crash the program at least.

I dont think it should continue, the error should be propagated up to cmd_rebase() (In your patch I think one of the context lines in run_git_commit() shows this happening)

Show 36 quoted lines
> 
>> [...]
>>
>>> +	if (opts->committer_date_is_author_date) {
>>> +		char *date = read_author_date_or_die();
>>> +		argv_array_pushf(&cmd.env_array, "GIT_COMMITTER_DATE=%s", date);
>>> +		free(date);
>>> +	}
>>
>> It's a shame to be doing this twice is slightly different ways in the
>> same function (and again in try_to_commit() but I don't think that can
>> be avoided as not all callers of run_git_commit() go through
>> try_to_commit()). As I think the child inherits the current environment
>> modified by cmd.env_array we could just call setenv() at the top of the
>> function. It would be worth looking to see if it would be simpler to do
>> the setenv() call in the loop that picks the commits, then we would
>> avoid having to do it in do_merge() and try_to_commit() separately.
> 
> Ok, I'll have to change the code according to what Junio suggested.
> Let's see how this area will look after that.
> 
>> [...]
>>
>>> +		if (file_exists(rebase_path_cdate_is_adate())) {
>>> +			opts->allow_ff = 0;
>>
>> This is safe as we don't save the state of allow_ff for rebases so it
>> wont be overridden later. It would be an idea to add to the checks in
>> the assert() at the beginning of pick_commits() no we have another
>> option that implies --force-rebase.
> 
> Are you suggesting to modify this assert() call (in pick_commits())?
> 
>      if (opts->allow_ff)
>          assert(!(opts->signoff || opts->no_commit ||
>                  opts->record_origin || opts->edit));
Yes I think it should check for opts->committer_date_is_author_date here
Best Wishes
Phillip
> Thanks
> Rohit
> 
Previous: Rohit AshiwalNext: Junio C Hamano
Message 15 of 32 in “rebase -i: support --ignore-whitespace”
  1. Rohit AshiwalJul 12, 2019
  2. [GSoC][PATCH 1/1] rebase -i: add --ignore-whitespace flagRohit Ashiwal, Jul 12, 2019
  3. Junio C HamanoJul 15, 2019
  4. Rohit AshiwalJul 15, 2019
  5. Junio C HamanoJul 15, 2019
  6. Rohit AshiwalJul 15, 2019
  7. [GSoC][PATCH 0/2] rebase -i: support --committer-date-is-author-dateRohit Ashiwal, Jul 12, 2019
  8. [GSoC][PATCH v2 0/2] rebase -i: support --committer-date-is-author-dateRohit Ashiwal, Jul 18, 2019
  9. [GSoC][PATCH v2 1/2] sequencer: add NULL checks under read_author_scriptRohit Ashiwal, Jul 18, 2019
  10. [GSoC][PATCH v2 2/2] rebase -i: support --committer-date-is-author-dateRohit Ashiwal, Jul 18, 2019
  11. Junio C HamanoJul 19, 2019
  12. Rohit AshiwalAug 2, 2019
  13. Phillip WoodJul 20, 2019
  14. Rohit AshiwalJul 23, 2019
  15. Phillip WoodJul 24, 2019
  16. Junio C HamanoJul 19, 2019
  17. Junio C HamanoJul 19, 2019
  18. [GSoC][PATCH 1/2] sequencer: add NULL checks under read_author_scriptRohit Ashiwal, Jul 12, 2019
  19. Junio C HamanoJul 15, 2019
  20. [GSoC][PATCH 2/2] rebase -i: support --committer-date-is-author-dateRohit Ashiwal, Jul 12, 2019
  21. Rohit AshiwalJul 14, 2019
  22. [GSoC][PATCH v2 0/1] rebase -i: support --ignore-whitespaceRohit Ashiwal, Jul 18, 2019
  23. [GSoC][PATCH v2 1/1] rebase -i: add --ignore-whitespace flagRohit Ashiwal, Jul 18, 2019
  24. Junio C HamanoJul 19, 2019
  25. Rohit AshiwalJul 23, 2019
  26. Junio C HamanoJul 23, 2019
  27. Phillip WoodJul 22, 2019
  28. Rohit AshiwalJul 23, 2019
  29. Elijah NewrenJul 23, 2019
  30. Johannes SchindelinJul 24, 2019
  31. [GSoC][PATCH v3 0/1] rebase -i: add --ignore-whitespace flagRohit Ashiwal, Jul 24, 2019
  32. [GSoC][PATCH v3 1/1] rebase -i: add --ignore-whitespace flagRohit Ashiwal, Jul 24, 2019

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.