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

Re: [PATCH] format-patch: print format-patch usage if there are no arguments

From
Stefan Beller <sbeller@google.com>
Date
Jan 13, 2015, 20:00 UTC
Message-ID
<CAGZ79kYJ+XNktc7_C81xz=BfCP4_hrE=pWW5QGJ1kdXKMf4Jjw@mail.gmail.com>
In-Reply-To
<xmqqppaicwww.fsf@gitster.dls.corp.google.com>
On Tue, Jan 13, 2015 at 11:17 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 18 quoted lines
> Alexander Kuleshov <kuleshovmail@gmail.com> writes:
>
>> 2015-01-14 0:43 GMT+06:00 Junio C Hamano <gitster@pobox.com>:
>>> Why?
>>
>> As some commands does it when they are executed without arguments,
>> like git config, git blame and etc...
>
> For format-patch, I think the current behaviour is more of the lack
> of implementation of the obvious default.  "git blame" does not have
> any obvious default (would there be a single file you would want to
> dig the history when the user does not tell you which one?  No), so
> it proabaly is the right thing to do to error out.
>
> But I would not surprised if those who build on top of others' work
> to wish that "git format-patch" that was invoked without argument on
> a branch created by "git checkout -t -b" to default to format commits
> since the branch forked from @{upstream}, for example.

My initial reaction was to assume HEAD^ if no arguments are given to format-patch. Though after thinking about it, the behavior you're proposing makes more sense.

Another idea would be to take the first commit which is pointed to by another branch as the first commit in the commit range. I am currently thinking about the atomic patch series which I developed on top of origin/mh/reflog-expire and that would be the first branch you find if you just go back in history and look for any branches. Usually that would be the upstream tracking branch though, so this would be an extension to your proposal.

Though I am not sure if this scales. (Who has many branches anyway? ;)
Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 10 in “format-patch: print format-patch usage if there are no arguments”
  1. format-patch: print format-patch usage if there are no argumentsAlexander Kuleshov, Jan 13, 2015
  2. Junio C HamanoJan 13, 2015
  3. Alexander KuleshovJan 13, 2015
  4. Junio C HamanoJan 13, 2015
  5. Stefan BellerJan 13, 2015
  6. Junio C HamanoJan 13, 2015
  7. Jeff KingJan 13, 2015
  8. Stefan BellerJan 13, 2015
  9. my hacky mutt-specific format-patch workflowJeff King, Jan 14, 2015
  10. Junio C HamanoJan 13, 2015

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.