All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rebase -i: respect to core.abbrev
@ 2013-09-28 16:07 Kirill A. Shutemov
  2013-09-28 21:10 ` Kirill A. Shutemov
  0 siblings, 1 reply; 4+ messages in thread
From: Kirill A. Shutemov @ 2013-09-28 16:07 UTC (permalink / raw)
  To: Junio C Hamano, git; +Cc: Eric Sunshine, Kirill A. Shutemov

git rebase -i collapses ids on todo list to 7 hexdigits.
Let's use core.abbrev config option instead, if it's set.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
 git-rebase--interactive.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 10bf318d0d..078c28ff1b 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -713,7 +713,8 @@ expand_todo_ids() {
 }
 
 collapse_todo_ids() {
-	transform_todo_ids --short=7
+	abbrev="$(git config --get 'core.abbrev')"
+	transform_todo_ids --short="${abbrev:-7}"
 }
 
 # Rearrange the todo list that has both "pick sha1 msg" and
-- 
1.8.4.rc3

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH] rebase -i: respect to core.abbrev
  2013-09-28 16:07 [PATCH] rebase -i: respect to core.abbrev Kirill A. Shutemov
@ 2013-09-28 21:10 ` Kirill A. Shutemov
  2013-09-29  2:49   ` Eric Sunshine
  2013-09-30 21:36   ` Jonathan Nieder
  0 siblings, 2 replies; 4+ messages in thread
From: Kirill A. Shutemov @ 2013-09-28 21:10 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: Junio C Hamano, git, Eric Sunshine, Kirill A. Shutemov

Kirill A. Shutemov wrote:
> git rebase -i collapses ids on todo list to 7 hexdigits.
> Let's use core.abbrev config option instead, if it's set.
> 
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
>  git-rebase--interactive.sh | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 10bf318d0d..078c28ff1b 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -713,7 +713,8 @@ expand_todo_ids() {
>  }
>  
>  collapse_todo_ids() {
> -	transform_todo_ids --short=7
> +	abbrev="$(git config --get 'core.abbrev')"
> +	transform_todo_ids --short="${abbrev:-7}"


Simpler version is below.

>From 933a4159f0c037a37f3b251a4f13deea7f17b6c3 Mon Sep 17 00:00:00 2001
From: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
Date: Sat, 28 Sep 2013 18:53:05 +0300
Subject: [PATCH] rebase -i: respect to core.abbrev

collapse_todo_ids() uses `git rev-parse --short=7' to abbrev commit ids.
Let's drop argument from --short to use default (7) or config value
instead.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
---
 git-rebase--interactive.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
index 10bf318d0d..3c6bed9a28 100644
--- a/git-rebase--interactive.sh
+++ b/git-rebase--interactive.sh
@@ -713,7 +713,7 @@ expand_todo_ids() {
 }
 
 collapse_todo_ids() {
-	transform_todo_ids --short=7
+	transform_todo_ids --short
 }
 
 # Rearrange the todo list that has both "pick sha1 msg" and
-- 
 Kirill A. Shutemov

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] rebase -i: respect to core.abbrev
  2013-09-28 21:10 ` Kirill A. Shutemov
@ 2013-09-29  2:49   ` Eric Sunshine
  2013-09-30 21:36   ` Jonathan Nieder
  1 sibling, 0 replies; 4+ messages in thread
From: Eric Sunshine @ 2013-09-29  2:49 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: Junio C Hamano, Git List

On Sat, Sep 28, 2013 at 5:10 PM, Kirill A. Shutemov
<kirill.shutemov@linux.intel.com> wrote:
> collapse_todo_ids() uses `git rev-parse --short=7' to abbrev commit ids.
> Let's drop argument from --short to use default (7) or config value
> instead.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
> ---
>  git-rebase--interactive.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/git-rebase--interactive.sh b/git-rebase--interactive.sh
> index 10bf318d0d..3c6bed9a28 100644
> --- a/git-rebase--interactive.sh
> +++ b/git-rebase--interactive.sh
> @@ -713,7 +713,7 @@ expand_todo_ids() {
>  }
>
>  collapse_todo_ids() {
> -       transform_todo_ids --short=7
> +       transform_todo_ids --short

Thanks, I was going to suggest this exact simplification upon reading v1.

Acked-by: Eric Sunshine <sunshine@sunshineco.com>

>  }
>
>  # Rearrange the todo list that has both "pick sha1 msg" and
> --
>  Kirill A. Shutemov

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] rebase -i: respect to core.abbrev
  2013-09-28 21:10 ` Kirill A. Shutemov
  2013-09-29  2:49   ` Eric Sunshine
@ 2013-09-30 21:36   ` Jonathan Nieder
  1 sibling, 0 replies; 4+ messages in thread
From: Jonathan Nieder @ 2013-09-30 21:36 UTC (permalink / raw)
  To: Kirill A. Shutemov; +Cc: Junio C Hamano, git, Eric Sunshine

Kirill A. Shutemov wrote:

> collapse_todo_ids() uses `git rev-parse --short=7' to abbrev commit ids.
> Let's drop argument from --short to use default (7) or config value
> instead.

Since the todo ids are expanded immediately after the editor exits,
there is not much risk of accidental hash collision due to new
objects, so this should be safe.

Thanks, both.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-09-30 21:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-09-28 16:07 [PATCH] rebase -i: respect to core.abbrev Kirill A. Shutemov
2013-09-28 21:10 ` Kirill A. Shutemov
2013-09-29  2:49   ` Eric Sunshine
2013-09-30 21:36   ` Jonathan Nieder

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.