git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: phillip.wood@dunelm.org.uk
Cc: Slavica Djukic <slavicadj.ip2018@gmail.com>,
	Junio C Hamano <gitster@pobox.com>,
	git@vger.kernel.org
Subject: Re: pw/add-p-select, was Re: What's cooking in git.git (Dec 2018, #01; Sun, 9)
Date: Tue, 11 Dec 2018 10:56:57 +0100 (STD)	[thread overview]
Message-ID: <nycvar.QRO.7.76.6.1812111049560.43@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <d69259ce-bc45-9201-693b-3902a6379265@talktalk.net>

Hi Phillip,

[Cc:ing Slavica, the Outreachy intern working on converting `add -i` to a
built-in]

On Mon, 10 Dec 2018, Phillip Wood wrote:

> On 09/12/2018 20:31, Johannes Schindelin wrote:
> > 
> > On Sun, 9 Dec 2018, Junio C Hamano wrote:
> > 
> > > * pw/add-p-select (2018-07-26) 4 commits
> > >   - add -p: optimize line selection for short hunks
> > >   - add -p: allow line selection to be inverted
> > >   - add -p: select modified lines correctly
> > >   - add -p: select individual hunk lines
> > >
> > >   "git add -p" interactive interface learned to let users choose
> > >   individual added/removed lines to be used in the operation, instead
> > >   of accepting or rejecting a whole hunk.
> > >
> > >   Will discard.
> > >   No further feedbacks on the topic for quite some time.
> > 
> > That is not quite true. I did comment that this feature
> 
> Sorry I meant to reply to that comment but never got round to it.

No worries. We're all busy down here.

> > (which I take as being inspired by Git GUI's "Stage Selected Line"),
> 
> not particularly, I don't use git gui I just wanted a way to easily
> stage a subset of lines without editing the hunk.

Okay. I used to use Git GUI quite a bit to stage individual lines, but
recently I tried to stay more in the terminal and used the `split` and
`edit` commands of `add -p` quite extensively. Wishing for an quicker way
to stage individual lines between all of my debug print statements.

> > and thought that it would be useful.
> > 
> > I could imagine, however, that it would make sense for `git add -p` to
> > imitate that feature more closely: by allowing to stage a single line
> > and then presenting the current hunk (re-computed) again.
> 
> that sounds like it would be quite tedious to stage more than a couple
> of lines,

It would be. But then, if you want to do anything slightly more
complicated than staging a hunk or a line, I personally prefer the `edit`
command *a lot*, as it lets me even split unrelated changes in the same
line into two commits.

> and it could be awkward to get it to stage modified lines correctly
> (While I was writing the feature I tried git gui, I think it is supposed
> to be able to stage modified lines correctly but I never persuaded it to
> do it for me. I also tried gitg, tig and hg commit -i but I couldn't get
> them to do modified lines either)

Git GUI works very reliably for me, but then, I have Git for Windows'
patched Git GUI at my finger tips (oh how I wish we had a Git GUI
maintainer again).

It should not be awkward to stage a single modified line at all.
Essentially, you take the hunk, strip out all `-` and `+` lines except the
one you want to stage, then stage that with `git apply --cached
--recount`, and then you simply re-generate that hunk.

> I'll try and re-roll in the New Year, when does the outreachy project
> for converting add -i start? - it would be good to try and get this
> pinned down before then.

Too late. Slavica started on December 4th, and you can even read about it
on their blog: https://slavicadj.github.io/blog/

Ciao,
Dscho

  reply	other threads:[~2018-12-11  9:57 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-09  8:42 What's cooking in git.git (Dec 2018, #01; Sun, 9) Junio C Hamano
2018-12-09  9:03 ` Denton Liu
2018-12-10  3:21   ` Junio C Hamano
2018-12-10  3:52     ` Denton Liu
2018-12-10 10:26       ` Junio C Hamano
2018-12-09 20:31 ` pw/add-p-select, was " Johannes Schindelin
2018-12-10 10:42   ` Phillip Wood
2018-12-11  9:56     ` Johannes Schindelin [this message]
2018-12-11 14:48       ` Phillip Wood
2019-01-21 20:58         ` Johannes Schindelin
2019-01-22 20:27           ` Phillip Wood
2018-12-10 18:53 ` Josh Steadmon
2018-12-11  1:43   ` Junio C Hamano
2018-12-10 20:05 ` Elijah Newren
2018-12-10 21:50   ` Ævar Arnfjörð Bjarmason
2018-12-11  1:49     ` Junio C Hamano
2018-12-11  1:48   ` Junio C Hamano
2018-12-11  2:00 ` Stefan Beller
2018-12-11  6:17   ` Junio C Hamano
2018-12-16 21:48 ` Alban Gruin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=nycvar.QRO.7.76.6.1812111049560.43@tvgsbejvaqbjf.bet \
    --to=johannes.schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=phillip.wood@dunelm.org.uk \
    --cc=slavicadj.ip2018@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).