All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kunal Tyagi via GitGitGadget" <gitgitgadget@gmail.com>
To: git@vger.kernel.org
Cc: Kunal Tyagi <tyagi.kunal@live.com>, Junio C Hamano <gitster@pobox.com>
Subject: [PATCH v3 0/1] git-add--interactive.perl: Add progress counter in the prompt
Date: Sun, 29 Sep 2019 22:22:58 -0700 (PDT)	[thread overview]
Message-ID: <pull.349.v3.git.gitgitgadget@gmail.com> (raw)
In-Reply-To: <pull.349.v2.git.gitgitgadget@gmail.com>

Hi git contributors!

I'm Kunal Tyagi. While I was choosing the relevant patches for a commit
using the git add -p command, I found that there was no feedback regarding
how many hunks from the current file had been processed and how many were
left. So I decided to add a small change to the prompt which basically just
displays (${current-hunk-id} + 1/${total-hunks}) before displaying the
prompt during user interaction. This patch doesn't account for all total
hunks, only per file.

I don't know perl so even this one liner might have mistakes. I did test
this locally and hope this works for others. Personally, this change feels
helpful to me when I have to separate a long list of changes after an
erroneous commit.

On the #git-devel freenode channel, I was informed that @dscho is rewriting
git-add in C. If so, perhaps a similar change could be added in the rewrite.
I haven't seen his patches in detail so I can't comment if it'll be as
trivial as in perl.

Regards Kunal Tyagi

Kunal Tyagi (1):
  add -i: Show progress counter in the prompt

 git-add--interactive.perl  | 2 +-
 t/t3701-add-interactive.sh | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)


base-commit: 4c86140027f4a0d2caaa3ab4bd8bfc5ce3c11c8a
Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-349%2Fkunaltyagi%2Fmaster-v3
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-349/kunaltyagi/master-v3
Pull-Request: https://github.com/gitgitgadget/git/pull/349

Range-diff vs v2:

 1:  a9c5906899 ! 1:  b351c74a3f git-add--interactive.perl: Add progress counter in the prompt
     @@ -1,14 +1,10 @@
      Author: Kunal Tyagi <tyagi.kunal@live.com>
      
     -    git-add--interactive.perl: Add progress counter in the prompt
     +    add -i: Show progress counter in the prompt
      
     -    Adds a feedback regarding how many hunks from the current file have been
     -    processed and total number of hunks
     -    Also included: changes to the test script due to change in expected
     -    output string
     -
     -    Change in UI: displays '(${current-hunk-id} + 1/${total-hunks-in-file})' before
     -    displaying the current prompt during user interaction
     +    Report the current hunk count and total number of hunks for the current
     +    file in the prompt
     +    Adjust the expected output in some tests to account for new data on the prompt
      
          Signed-off-by: Kunal Tyagi <tyagi.kunal@live.com>
      
     @@ -20,7 +16,7 @@
       			print;
       		}
      -		print colored $prompt_color,
     -+		print colored $prompt_color,"(". ($ix+1) ."/$num) ",
     ++		print colored $prompt_color, "(", ($ix+1), "/$num) ",
       			sprintf(__($patch_update_prompt_modes{$patch_mode}{$hunk[$ix]{TYPE}}), $other);
       
       		my $line = prompt_single_character;
     @@ -33,7 +29,7 @@
       	git apply patch &&
       	printf "%s\n" s y y | git add -p file 2>error |
      -		sed -n -e "s/^Stage this hunk[^@]*\(@@ .*\)/\1/" \
     -+		sed -n -e "s/^(.*) Stage this hunk[^@]*\(@@ .*\)/\1/" \
     ++		sed -n -e "s/^([1-2]\/[1-2]) Stage this hunk[^@]*\(@@ .*\)/\1/" \
       		       -e "/^[-+@ \\\\]"/p  >output &&
       	test_must_be_empty error &&
       	git diff --cached >diff &&

-- 
gitgitgadget

  parent reply	other threads:[~2019-09-30  5:24 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-23  7:26 [PATCH 0/1] git-add--interactive.perl: Add progress counter in the prompt Kunal Tyagi via GitGitGadget
2019-09-23  7:26 ` [PATCH 1/1] " Kunal Tyagi via GitGitGadget
2019-09-25 15:38   ` Johannes Schindelin
2019-09-25 15:35 ` [PATCH 0/1] " Johannes Schindelin
2019-09-29  1:30 ` [PATCH v2 " Kunal Tyagi via GitGitGadget
2019-09-29  1:30   ` [PATCH v2 1/1] " Kunal Tyagi via GitGitGadget
2019-09-30  1:34     ` Junio C Hamano
2019-09-30 17:30       ` Johannes Schindelin
2019-09-30  5:22   ` Kunal Tyagi via GitGitGadget [this message]
2019-09-30  5:22     ` [PATCH v3 1/1] add -i: Show " Kunal Tyagi via GitGitGadget
2019-10-04  5:52       ` Junio C Hamano

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

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

  git send-email \
    --in-reply-to=pull.349.v3.git.gitgitgadget@gmail.com \
    --to=gitgitgadget@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=tyagi.kunal@live.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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.