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

Re: [PATCH 2/2] restore: default to HEAD when combining --worktree and --staged

From
Eric Sunshine <sunshine@sunshineco.com>
Date
May 5, 2020, 04:00 UTC
Message-ID
<CAPig+cTAab6E4TPLL5AA75Ss9hQxCo2ZKLQaDakO=gGPvse+cQ@mail.gmail.com>
In-Reply-To
<20200501221951.GD41612@syl.local>
On Fri, May 1, 2020 at 6:20 PM Taylor Blau <me@ttaylorr.com> wrote:
Show 6 quoted lines
> On Fri, May 01, 2020 at 04:27:46AM -0400, Eric Sunshine wrote:
> > The default restore source for --worktree is the index, and the default
> > source for --staged is HEAD. However, when combining --worktree and
>
> I think that you could very reasonably drop the first sentence here,
> especially because it is repeated verbatim from the previous commit.

The repetition is intentional so that each commit can be understood stand-alone (without having to know what came before it).

Show 5 quoted lines
> In fact... this whole paragraph looks similar to me. Maybe just:
>
>  When invoking 'git restore' with both '--worktree' and '--staged', it
>  is required that the ambiguity of which source to restore from be
>  resolved by also passing '--source'.
I'll see if I can trim it down a bit -- Junio also found it too long.
Show 11 quoted lines
> > -By default, the restore sources for working tree and the index are the
> > -index and `HEAD` respectively. `--source` could be used to specify a
> > -commit as the restore source; it is required when combining `--staged`
> > -and `--worktree`.
> > +By default, the restore source for `--worktree` is the index, and the
> > +restore source for `--staged` is `HEAD`. When combining `--worktree` and
> > +`--staged`, the restore source is `HEAD`. `--source` can be used to specify
>
> This is extremely nit-pick-y, but is this line a little over-long? My
> memory is that Documentation should be wrapped at 72 characters instead
> of 80. I culd be totally wrong.

Column 72 for commit messages, certainly, but I don't think there is any such guideline about documentation also being wrapped at 72. As an old-schooler who still uses 80-column terminal and editor windows, I'm quite sensitive to line length -- these lines are wrapped at 79.

Previous: Taylor BlauNext: Taylor Blau
Message 9 of 10 in “enhance "git restore --worktree --staged" behavior”
  1. 0/2 enhance "git restore --worktree --staged" behaviorEric Sunshine, May 1, 2020
  2. 1/2 restore: require --source when combining --worktree and --stagedEric Sunshine, May 1, 2020
  3. Eric SunshineMay 1, 2020
  4. Taylor BlauMay 1, 2020
  5. 2/2 restore: default to HEAD when combining --worktree and --stagedEric Sunshine, May 1, 2020
  6. Junio C HamanoMay 1, 2020
  7. Eric SunshineMay 5, 2020
  8. Taylor BlauMay 1, 2020
  9. Eric SunshineMay 5, 2020
  10. Taylor BlauMay 5, 2020

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.