Git development
 help / color / mirror / Atom feed
* Re: [PATCH] contrib/workdir: create logs/refs and rr-cache in the origin repository
From: Junio C Hamano @ 2009-01-19 19:48 UTC (permalink / raw)
  To: Adeodato Simó; +Cc: git
In-Reply-To: <20090119122018.GA25566@chistera.yi.org>

Adeodato Simó <dato@net.com.org.es> writes:

> * Junio C Hamano [Sun, 18 Jan 2009 11:59:35 -0800]:
> ...
>>     A workdir is a new work area that is not a normal "work tree with a
>>     full repository", but borrows from an existing repository.  Any side
>>     effect from the work you do in a workdir will be saved in the original
>>     repository, and removing one would lose only the three kind of
>>     information listed above.  Creating a new workdir has the side effect
>>     of enabling reflogs and rerere in the original repository.
>
>> But the last sentence somehow feels dirty.
>
> I really don't understand that last sentence. Does "mkdir logs/refs rr-cache"
> *enable* reflogs and rerere at all? Or, rather, it just gives an empty
> space for the workdirs "connecting" to it to save their reflogs and
> rerere stuff iff they are configured to do so?

I thought rerere does not kick in if rr-cache is absent, and it kicks in
if rr-cache is present when you do not explicitly disable it.  So creation
of directory is a way to enable it.  Besides, the net effect for a person
who does not want to have the bare repository contaminated with these
directories is the same.  The original repository aquires them.

As I said already, I suspect that it would be more useful in practice to
create these directories as your patch did, than making the new workdir
inherit the lack of rerere and reflog support if the original repository
lacked them.  I just wanted to see some documentation that makes it clear
that the original repository _is_ modified by a creation of a new workdir.

^ permalink raw reply

* Re: how to track multiple upstreams in one repository
From: david @ 2009-01-19 21:08 UTC (permalink / raw)
  To: Julian Phillips; +Cc: git
In-Reply-To: <alpine.LNX.2.00.0901191627480.4115@reaper.quantumfyre.co.uk>

On Mon, 19 Jan 2009, Julian Phillips wrote:

> On Sun, 18 Jan 2009, david@lang.hm wrote:
>
>> for linux I want to track both the linus tree and the -stable tree. Ideally 
>> I want to be able to do a checkout of tags from either tree from the same 
>> directory (along with diffs between items in both trees, etc)
>> 
>> I have found documentation on how to clone from each of them, but I haven't 
>> found any simple documentation on how to work with both of them.
>
> You could always just use 
> git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6-stable.git ? 
> It already contains both the linus tree and all the stable trees ...

I know it contains the releases, but does it contain the -rc trees?

David Lang

^ permalink raw reply

* [PATCH] Provide pessimistic defaults for cross compilation tests.
From: Ralf Wildenhues @ 2009-01-19 20:34 UTC (permalink / raw)
  To: Julius Naperkowski, git
In-Reply-To: <20090116094110.GD25275@ins.uni-bonn.de>

In a cross compile setup, configure tests that run programs
cannot be executed; in that case, provide pessimistic default
values.

Bug reported by Julius Naperkowski.
---

> I can post a patch to add sane default settings for AC_RUN_IFELSE in
> cross compile setups, this weekend.

 configure.ac |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/configure.ac b/configure.ac
index 363547c..4a208d4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -360,6 +360,7 @@ AC_RUN_IFELSE(
 		else if (strcmp(buf, "12345"))
 		  return 2;]])],
 	[ac_cv_c_c99_format=yes],
+	[ac_cv_c_c99_format=no],
 	[ac_cv_c_c99_format=no])
 ])
 if test $ac_cv_c_c99_format = no; then
@@ -380,6 +381,7 @@ AC_RUN_IFELSE(
 		FILE *f = fopen(".", "r");
 		return f && fread(&c, 1, 1, f)]])],
 	[ac_cv_fread_reads_directories=no],
+	[ac_cv_fread_reads_directories=yes],
 	[ac_cv_fread_reads_directories=yes])
 ])
 if test $ac_cv_fread_reads_directories = yes; then
@@ -414,6 +416,7 @@ AC_RUN_IFELSE(
 		  if (snprintf(buf, 3, "%s", "12345") != 5
 		      || strcmp(buf, "12")) return 1]])],
 	[ac_cv_snprintf_returns_bogus=no],
+	[ac_cv_snprintf_returns_bogus=yes],
 	[ac_cv_snprintf_returns_bogus=yes])
 ])
 if test $ac_cv_snprintf_returns_bogus = yes; then
-- 
1.6.1.137.g3d9e8

^ permalink raw reply related

* [PATCH] Fix naming scheme for configure cache variables.
From: Ralf Wildenhues @ 2009-01-19 20:34 UTC (permalink / raw)
  To: git

In order to be cached, configure variables need to contain the
string '_cv_', and they should begin with a package-specific
prefix in order to avoid interfering with third-party macros.
Rename ld_dashr, ld_wl_rpath, ld_rpath to git_cv_ld_dashr etc.
---

This avoids a warning with newer autoconf versions about the naming of
the cache variables, and makes the caching work for them.

As to the 'git_' prefix, it could be argued that the other cache
variables used in configure.ac should also be renamed s/ac_/git_/
If you like, I can provide a patch for those, too.

Thanks,
Ralf

 configure.ac |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/configure.ac b/configure.ac
index 0a5fc8c..363547c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -114,31 +114,31 @@ AC_MSG_NOTICE([CHECKS for programs])
 #
 AC_PROG_CC([cc gcc])
 # which switch to pass runtime path to dynamic libraries to the linker
-AC_CACHE_CHECK([if linker supports -R], ld_dashr, [
+AC_CACHE_CHECK([if linker supports -R], git_cv_ld_dashr, [
    SAVE_LDFLAGS="${LDFLAGS}"
    LDFLAGS="${SAVE_LDFLAGS} -R /"
-   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_dashr=yes], [ld_dashr=no])
+   AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_dashr=yes], [git_cv_ld_dashr=no])
    LDFLAGS="${SAVE_LDFLAGS}"
 ])
-if test "$ld_dashr" = "yes"; then
+if test "$git_cv_ld_dashr" = "yes"; then
    AC_SUBST(CC_LD_DYNPATH, [-R])
 else
-   AC_CACHE_CHECK([if linker supports -Wl,-rpath,], ld_wl_rpath, [
+   AC_CACHE_CHECK([if linker supports -Wl,-rpath,], git_cv_ld_wl_rpath, [
       SAVE_LDFLAGS="${LDFLAGS}"
       LDFLAGS="${SAVE_LDFLAGS} -Wl,-rpath,/"
-      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_wl_rpath=yes], [ld_wl_rpath=no])
+      AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_wl_rpath=yes], [git_cv_ld_wl_rpath=no])
       LDFLAGS="${SAVE_LDFLAGS}"
    ])
-   if test "$ld_wl_rpath" = "yes"; then
+   if test "$git_cv_ld_wl_rpath" = "yes"; then
       AC_SUBST(CC_LD_DYNPATH, [-Wl,-rpath,])
    else
-      AC_CACHE_CHECK([if linker supports -rpath], ld_rpath, [
+      AC_CACHE_CHECK([if linker supports -rpath], git_cv_ld_rpath, [
          SAVE_LDFLAGS="${LDFLAGS}"
          LDFLAGS="${SAVE_LDFLAGS} -rpath /"
-         AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [ld_rpath=yes], [ld_rpath=no])
+         AC_LINK_IFELSE(AC_LANG_PROGRAM([], []), [git_cv_ld_rpath=yes], [git_cv_ld_rpath=no])
          LDFLAGS="${SAVE_LDFLAGS}"
       ])
-      if test "$ld_rpath" = "yes"; then
+      if test "$git_cv_ld_rpath" = "yes"; then
          AC_SUBST(CC_LD_DYNPATH, [-rpath])
       else
          AC_MSG_WARN([linker does not support runtime path to dynamic libraries])
-- 
1.6.1.137.g3d9e8

^ permalink raw reply related

* Re: how to track multiple upstreams in one repository
From: Julian Phillips @ 2009-01-19 20:45 UTC (permalink / raw)
  To: david; +Cc: git
In-Reply-To: <alpine.DEB.1.10.0901191308030.2428@asgard.lang.hm>

On Mon, 19 Jan 2009, david@lang.hm wrote:

> On Mon, 19 Jan 2009, Julian Phillips wrote:
>
>>  On Sun, 18 Jan 2009, david@lang.hm wrote:
>> 
>> >  for linux I want to track both the linus tree and the -stable tree. 
>> >  Ideally I want to be able to do a checkout of tags from either tree from 
>> >  the same directory (along with diffs between items in both trees, etc)
>> > 
>> >  I have found documentation on how to clone from each of them, but I 
>> >  haven't found any simple documentation on how to work with both of them.
>>
>>  You could always just use
>>  git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6-stable.git
>>  ? It already contains both the linus tree and all the stable trees ...
>
> I know it contains the releases, but does it contain the -rc trees?

It seems to contain everything from the main Linus tree as far as I can 
see from the gitweb (haven't actually used it for kernel work).

>
> David Lang
>
>

-- 
Julian

  ---
Stock's Observation:
 	You no sooner get your head above water but what someone pulls
 	your flippers off.

^ permalink raw reply

* [PATCH v2 1/2] bash completion: move pickaxe options to log
From: Thomas Rast @ 2009-01-19 21:17 UTC (permalink / raw)
  To: git; +Cc: Shawn O. Pearce, Junio C Hamano
In-Reply-To: <20090119173153.GB14053@spearce.org>

Move the options --pickaxe-all and --pickaxe-regex to git-log, where
they make more sense than with git-diff.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>

---

Shawn O. Pearce wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> > The changes around pickaxe made me "Huh?".  For log pickaxe makes very
> > good sense but for a single diff it doesn't, yet the original seems to
> > have had them only on "git diff" and not on "git log", which feels wrong.
> 
> I agree completely.  The pickaxe stuff in current completion is
> just plain wrong.  I'd like to see it fixed with this cleanup.
> Maybe do it in two parts; fix the pickaxe options to be on log
> and not diff, and then do the cleanup for the common options.

Good point.  Sorry for not noticing in the first place; I was too
focused on just getting git-show completion working ;-)


 contrib/completion/git-completion.bash |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 60497a4..b5d3bbb 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -784,7 +784,7 @@ _git_diff ()
 			--patch-with-stat --name-only --name-status --color
 			--no-color --color-words --no-renames --check
 			--full-index --binary --abbrev --diff-filter=
-			--find-copies-harder --pickaxe-all --pickaxe-regex
+			--find-copies-harder
 			--text --ignore-space-at-eol --ignore-space-change
 			--ignore-all-space --exit-code --quiet --ext-diff
 			--no-ext-diff
@@ -986,6 +986,7 @@ _git_log ()
 			--parents --children --full-history
 			--merge
 			--inter-hunk-context=
+			--pickaxe-all --pickaxe-regex
 			"
 		return
 		;;
-- 
tg: (28da86a..) t/bash-complete-pickaxe (depends on: origin/master)

^ permalink raw reply related

* [PATCH v2 2/2] bash completion: refactor diff options
From: Thomas Rast @ 2009-01-19 21:18 UTC (permalink / raw)
  To: git; +Cc: Shawn O. Pearce, Junio C Hamano
In-Reply-To: <1232399880-22036-1-git-send-email-trast@student.ethz.ch>

diff, log and show all take the same diff options.  Refactor them from
__git_diff and __git_log into a variable, and complete them in
__git_show too.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>

---
 contrib/completion/git-completion.bash |   36 ++++++++++++++++++-------------
 1 files changed, 21 insertions(+), 15 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index 096603b..bfae953 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -773,14 +773,7 @@ _git_describe ()
 	__gitcomp "$(__git_refs)"
 }
 
-_git_diff ()
-{
-	__git_has_doubledash && return
-
-	local cur="${COMP_WORDS[COMP_CWORD]}"
-	case "$cur" in
-	--*)
-		__gitcomp "--cached --stat --numstat --shortstat --summary
+__git_diff_common_options="--stat --numstat --shortstat --summary
 			--patch-with-stat --name-only --name-status --color
 			--no-color --color-words --no-renames --check
 			--full-index --binary --abbrev --diff-filter=
@@ -789,9 +782,21 @@ _git_diff ()
 			--ignore-all-space --exit-code --quiet --ext-diff
 			--no-ext-diff
 			--no-prefix --src-prefix= --dst-prefix=
-			--base --ours --theirs
 			--inter-hunk-context=
 			--patience
+			--raw
+"
+
+_git_diff ()
+{
+	__git_has_doubledash && return
+
+	local cur="${COMP_WORDS[COMP_CWORD]}"
+	case "$cur" in
+	--*)
+		__gitcomp "--cached --pickaxe-all --pickaxe-regex
+			--base --ours --theirs
+			$__git_diff_common_options
 			"
 		return
 		;;
@@ -977,17 +982,16 @@ _git_log ()
 			--relative-date --date=
 			--author= --committer= --grep=
 			--all-match
-			--pretty= --name-status --name-only --raw
+			--pretty=
 			--not --all
 			--left-right --cherry-pick
 			--graph
-			--stat --numstat --shortstat
-			--decorate --diff-filter=
-			--color-words --walk-reflogs
+			--decorate
+			--walk-reflogs
 			--parents --children --full-history
 			--merge
 			--inter-hunk-context=
-			--patience
+			$__git_diff_common_options
 			--pickaxe-all --pickaxe-regex
 			"
 		return
@@ -1492,7 +1496,9 @@ _git_show ()
 		return
 		;;
 	--*)
-		__gitcomp "--pretty="
+		__gitcomp "--pretty=
+			$__git_diff_common_options
+			"
 		return
 		;;
 	esac
-- 
tg: (3f8c856..) t/bash-complete-show (depends on: origin/next t/bash-complete-pickaxe t/bash-complete-pickaxe)

^ permalink raw reply related

* [PATCH v2] bash: offer to show (un)staged changes
From: Thomas Rast @ 2009-01-19 21:38 UTC (permalink / raw)
  To: git; +Cc: Shawn O. Pearce, Junio C Hamano
In-Reply-To: <20090119172939.GA14053@spearce.org>

Add a bit of code to __git_ps1 that lets it append '*' to the branch
name if there are any unstaged changes, and '+' if there are any
staged changes.

Since this is a rather expensive operation and will force a lot of
data into the cache whenever you first enter a repository, you have to
enable it manually by setting bash.showDirtyState to a true value.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>

---

Shawn O. Pearce wrote:
> Junio C Hamano <gitster@pobox.com> wrote:
> > This makes the feature unavailable for people who care about the stat
> > dirtiness and explicitly set diff.autorefreshindex to false, doesn't it?
> 
> Yup, and I'm one of those people who sets autorefresindex to false
> in my ~/.gitconfig, usually before I even have user.{name,email} set.

I tried to alleviate the problem with a combination of diff options
that hopefully does the right thing in all cases.

> I do like the idea of what Thomas is trying to do here, but its
> so bloody expensive to compute dirty state on every prompt in
> some repositories that I'd shoot myself.  E.g. WebKit is huge,
> computing the dirty state inside of the WebKit repository on each
> prompt would absolutely kill CLI performance to a point of it not
> being usuable.  But git.git is small enough its OK on pretty much
> everything except Cygwin.
> 
> So as much as I'd like to use this without the update-index --refresh
> bit, I'm not sure its viable in every project out there.

I mostly work on small-ish repos, and while the initial loading is
_very_ noticeable, it's ok after that.  But your point about repos
being different is very good, so I changed the patch to use a
git-config variable instead of a shell environment variable.  That
way, you could even configure it to a different setting per-repo.

(Which might end up rather confusing, but at least it's possible.)


 contrib/completion/git-completion.bash |   22 ++++++++++++++++++++--
 1 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/contrib/completion/git-completion.bash b/contrib/completion/git-completion.bash
index f8b845a..7864ca7 100755
--- a/contrib/completion/git-completion.bash
+++ b/contrib/completion/git-completion.bash
@@ -34,6 +34,10 @@
 #       are currently in a git repository.  The %s token will be
 #       the name of the current branch.
 #
+#	In addition, if you set bash.showDirtyState to a true value,
+#	unstaged (*) and staged (+) changes will be shown next to the
+#	branch name.
+#
 # To submit patches:
 #
 #    *) Read Documentation/SubmittingPatches
@@ -116,10 +120,24 @@ __git_ps1 ()
 			fi
 		fi
 
+		local w
+		local i
+
+		if test "$(git config --bool bash.showDirtyState)" = "true"; then
+			git diff --no-ext-diff --ignore-submodules \
+				--quiet --exit-code || w="*"
+			if git rev-parse --quiet --verify HEAD >/dev/null; then
+				git diff-index --cached --quiet \
+					--ignore-submodules HEAD -- || i="+"
+			else
+				i="#"
+			fi
+		fi
+
 		if [ -n "${1-}" ]; then
-			printf "$1" "${b##refs/heads/}$r"
+			printf "$1" "${b##refs/heads/}$w$i$r"
 		else
-			printf " (%s)" "${b##refs/heads/}$r"
+			printf " (%s)" "${b##refs/heads/}$w$i$r"
 		fi
 	fi
 }
-- 
tg: (7bbd8d6..) t/ps1-dirty-state (depends on: origin/master)

^ permalink raw reply related

* Re: Syncing with CVS
From: Robin Rosenberg @ 2009-01-19 22:05 UTC (permalink / raw)
  To: Christian von Kietzell; +Cc: git
In-Reply-To: <f31e50960901190139w65b69fd1k752973a23c40f384@mail.gmail.com>

måndag 19 januari 2009 10:39:53 skrev Christian von Kietzell:
> Hi,
> 
> I have a project I started in git. After a while I exported that to
> CVS via git cvsexportcommit which worked quite nicely. Now, a
> colleague made changes to the project - in CVS. What's the best way to
> get those back into my git repository so that I'll be able to sync
> back and forth between git and CVS? I had a quick look at the wiki but
> couldn't find anything appropriate.
> 
> I know of git cvsimport, of course, but that doesn't work on my
> original repository. Or does it? I didn't find anything on how to
> limit what to import. After all, some of the commits are already in my
> repository (the ones I exported).
Just continue with cvsimport, then git rebase origin. That'll drop the
commits that you made when the same commit have been discovered
in CVS.

I personally do the cvs import into a separate repo using a cron job. That
extra repo is my origin so I get up-to-date using git fetch and rebase just
as if the CVS commits would come from a real repo.

-- robin

^ permalink raw reply

* [PATCH,v2] git-checkout(1): mention fate of extraneous files
From: jidanni @ 2009-01-19 22:45 UTC (permalink / raw)
  To: gitster; +Cc: git, markus.heidelberg
In-Reply-To: <877i4teq78.fsf@jidanni.org>

Signed-off-by: jidanni <jidanni@jidanni.org>
---
 Documentation/git-checkout.txt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 9cd5151..58abdc6 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -17,7 +17,8 @@ DESCRIPTION
 When <paths> are not given, this command switches branches by
 updating the index and working tree to reflect the specified
 branch, <branch>, and updating HEAD to be <branch> or, if
-specified, <new_branch>.  Using -b will cause <new_branch> to
+specified, <new_branch>. (No files are deleted, use linkgit:git-clean[1]
+for a pristine checkout.) Using -b will cause <new_branch> to
 be created; in this case you can use the --track or --no-track
 options, which will be passed to `git branch`.
 
-- 
1.6.0.6

^ permalink raw reply related

* [PATCH] commit: more compact summary and without extra quotes
From: Santi Béjar @ 2009-01-19 22:45 UTC (permalink / raw)
  To: git

Original:
[master]: created d9a5491: "foo:bar"

While with the patch it becomes:
[master d9a5491] foo:bar

As discussed in the git mailing list:

http://marc.info/?l=git&m=122765031208922&w=2

Signed-off-by: Santi Béjar <santi@agolina.net>
---
 builtin-commit.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/builtin-commit.c b/builtin-commit.c
index 2f0b00a..b159af2 100644
--- a/builtin-commit.c
+++ b/builtin-commit.c
@@ -883,7 +883,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 {
 	struct rev_info rev;
 	struct commit *commit;
-	static const char *format = "format:%h: \"%s\"";
+	static const char *format = "format:%h] %s";
 	unsigned char junk_sha1[20];
 	const char *head = resolve_ref("HEAD", junk_sha1, 0, NULL);
 
@@ -910,7 +910,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 	rev.diffopt.break_opt = 0;
 	diff_setup_done(&rev.diffopt);
 
-	printf("[%s%s]: created ",
+	printf("[%s%s ",
 		!prefixcmp(head, "refs/heads/") ?
 			head + 11 :
 			!strcmp(head, "HEAD") ?
-- 
1.6.1.258.g7ff14

^ permalink raw reply related

* Re: [PATCH v4 0/7] customizable --color-words
From: Santi Béjar @ 2009-01-19 22:47 UTC (permalink / raw)
  To: Thomas Rast
  Cc: git, Junio C Hamano, Johannes Schindelin, Boyd Stephen Smith Jr.,
	Teemu Likonen
In-Reply-To: <1232209788-10408-1-git-send-email-trast@student.ethz.ch>

2009/1/17 Thomas Rast <trast@student.ethz.ch>:
> Johannes Schindelin (4):
>  Add color_fwrite_lines(), a function coloring each line individually
>  color-words: refactor word splitting and use ALLOC_GROW()
>  color-words: change algorithm to allow for 0-character word
>    boundaries
>  color-words: take an optional regular expression describing words
>
> Thomas Rast (3):
>  color-words: enable REG_NEWLINE to help user
>  color-words: expand docs with precise semantics
>  color-words: make regex configurable via attributes
>

Also, having a config (diff.color-words?) to set the default regexp
would be great. Thanks.

Santi

^ permalink raw reply

* [StGit PATCH] Added basic bash completion script for StGit.
From: ted @ 2009-01-19 22:57 UTC (permalink / raw)
  To: catalin.marinas; +Cc: git, Ted Pavlic

From: Ted Pavlic <ted@tedpavlic.com>

Signed-off-by: Ted Pavlic <ted@tedpavlic.com>
---
 contrib/completion/stg-completion.bash |  106 ++++++++++++++++++++++++++++++++
 1 files changed, 106 insertions(+), 0 deletions(-)
 create mode 100755 contrib/completion/stg-completion.bash

diff --git a/contrib/completion/stg-completion.bash b/contrib/completion/stg-completion.bash
new file mode 100755
index 0000000..13cc792
--- /dev/null
+++ b/contrib/completion/stg-completion.bash
@@ -0,0 +1,106 @@
+#!bash
+#
+# bash completion support for Stacked Git (StGit).
+#
+# Copyright (c) 2009 by Theodore P. Pavlic <ted@tedpavlic.com>
+# Distributed under the GNU General Public License, version 2.0.
+#
+# Design is highly influenced by completion scripts for Mercurial and
+# git.
+#
+# To use these routines:
+#
+#    1) Copy this file to somewhere (e.g. ~/.stg-completion.sh).
+#    2) Added the following line to your .bashrc or .bash_profile:
+#        source ~/.stg-completion.sh
+#
+# To submit patches:
+#
+#    *) Read Documentation/SubmittingPatches
+#    *) Send all patches to the Git mailing list
+#
+#           git@vger.kernel.org
+#
+#       and CC the message to the StGit maintainer
+#
+#           catalin.marinas@gmail.com
+#
+#       Prefix the subject with something like "[StGit PATCH]",
+#       "[StGit PATCH i/n]", "[StGit PATCH RFC]", or similar. Patches
+#       should be "Signed-off-by:" you as described in
+#       Documentation/SubmittingPatches.
+#
+#       It is recommended that editors submit patches using utilities
+#       like
+#
+#           stg mail
+#           git send-email
+#           git format-patch
+#
+#       In the latter case, make sure e-amils submitted to the list do
+#       not have "format=flowed" and do not "word wrap" your patch.
+#
+
+# This 'extglob' bash option allows for
+#       if [[ $param == @(-h|--help) ]]
+# type statements. That is, the pattern is true if $param matches -h OR
+# --help
+shopt -s extglob
+
+__stg_commands()
+{
+    local commands
+    commands="$("$stg" help|grep '^ '|cut -f3 -d' ' 2>/dev/null)" || commands=""
+    COMPREPLY=(${COMPREPLY[@]:-} $(compgen -W '$commands' -- "$cur"))
+}
+
+__stg()
+{
+    local cur prev cmd
+    local stg="$1"
+
+    COMPREPLY=()
+    cur="$2"
+    prev="$3"
+
+    if [ $COMP_CWORD -gt 1 ]; then
+        # Try to complete the argument to an already complete stg command
+        # (e.g., "stg command partial<tab>")
+        cmd=${COMP_WORDS[${COMP_CWORD}-1]}
+        __stg_specific_command
+    else
+        # Try to complete an incomplete stg command (possibly blank)
+        # (e.g., "stg partial<tab>")
+        __stg_commands
+    fi
+
+}
+
+# Handle "stg command <tab>" completion
+__stg_specific_command()
+{
+    # Here, try to find (possibly user-defined) functions that match the
+    # command
+    if [ "$(type -t "__stg_cmd_$cmd")" = function ]; then
+        "__stg_cmd_$cmd"
+        return 0
+    fi
+
+    # Special handling of particular stg commands can be placed here
+    case "$cmd" in
+        help)
+            # Complete help with all possible help commands
+            __stg_commands
+            ;;
+        *)
+            # Bail out to normal bash completion
+            return 1
+            ;;
+   esac
+
+   return 0
+}
+
+# Use __stg for stg completion and bail out to normal bash completion
+complete -o bashdefault -o default -F __stg stg 2>/dev/null \
+    || complete -o default -F __stg stg
-- 
1.6.1.87.g15624

^ permalink raw reply related

* Re: [PATCH 2/2] expand --pretty=format color options
From: Junio C Hamano @ 2009-01-19 23:10 UTC (permalink / raw)
  To: Jeff King; +Cc: René Scharfe, Markus Heidelberg, git
In-Reply-To: <20090118195342.GA612@coredump.intra.peff.net>

Jeff King <peff@peff.net> writes:

> Hrm. OK, it doesn't actually work always. It does for git-log, but not
> for rev-list, which leaves diff_use_color_default as -1. I don't know if
> there are any other ways you can get to this code path without having
> set diff_use_color_default.

Yuck, no matter what you do please don't contaminate plumbing with the UI
color options.

> Maybe it is time to do a cleanup on the color handling, which has
> provided no end of these bugs. I will have to leave that for another
> day, though.

^ permalink raw reply

* Re: [StGit PATCH] Added basic bash completion script for StGit.
From: Ted Pavlic @ 2009-01-19 23:15 UTC (permalink / raw)
  To: Ted Pavlic; +Cc: catalin.marinas, git
In-Reply-To: <1232405879-6188-1-git-send-email-ted@tedpavlic.com>

> +# Use __stg for stg completion and bail out to normal bash completion
> +complete -o bashdefault -o default -F __stg stg 2>/dev/null \
> +    || complete -o default -F __stg stg

Somehow I didn't see the existing

	stgit-completion.bash

in stgit.git. I was looking in stgit.git/contrib, which is where Git 
(and Mercurial) puts its completion script.

So it looks like there's no need for this patch.

Thanks --
Ted

-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

^ permalink raw reply

* Re: [PATCH,v2] git-checkout(1): mention fate of extraneous files
From: Boyd Stephen Smith Jr. @ 2009-01-19 23:16 UTC (permalink / raw)
  To: jidanni; +Cc: gitster, git, markus.heidelberg
In-Reply-To: <87priivrt3.fsf_-_@jidanni.org>

[-- Attachment #1: Type: text/plain, Size: 721 bytes --]

>-specified, <new_branch>.  Using -b will cause <new_branch> to
>+specified, <new_branch>. (No files are deleted, use linkgit:git-clean[1]
>+for a pristine checkout.) Using -b will cause <new_branch> to

The parenthetical remark is not true, here:
$ git status
# On branch anagrams
nothing to commit (working directory clean)
$ ls
anagram  fsdupfind
$ git checkout master
Switched to branch "master"
$ ls
fsdupfind

I think you mean "No untracked content is removed,...".
-- 
Boyd Stephen Smith Jr.                     ,= ,-_-. =. 
bss@iguanasuicide.net                     ((_/)o o(\_))
ICQ: 514984 YM/AIM: DaTwinkDaddy           `-'(. .)`-' 
http://iguanasuicide.net/                      \_/     

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply

* Re: [PATCH,v3] git-checkout(1): mention fate of extraneous files
From: jidanni @ 2009-01-19 23:31 UTC (permalink / raw)
  To: bss; +Cc: gitster, git, markus.heidelberg
In-Reply-To: <200901191716.59373.bss@iguanasuicide.net>

Signed-off-by: jidanni <jidanni@jidanni.org>
---
Thanks Boyd.
 Documentation/git-checkout.txt |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-checkout.txt b/Documentation/git-checkout.txt
index 9cd5151..56e1ec9 100644
--- a/Documentation/git-checkout.txt
+++ b/Documentation/git-checkout.txt
@@ -17,7 +17,8 @@ DESCRIPTION
 When <paths> are not given, this command switches branches by
 updating the index and working tree to reflect the specified
 branch, <branch>, and updating HEAD to be <branch> or, if
-specified, <new_branch>.  Using -b will cause <new_branch> to
+specified, <new_branch>. (To also delete untracked content
+use linkgit:git-clean[1].) Using -b will cause <new_branch> to
 be created; in this case you can use the --track or --no-track
 options, which will be passed to `git branch`.
 
-- 
1.6.0.6

^ permalink raw reply related

* Re: [StGit PATCH] Added basic bash completion script for StGit.
From: Ted Pavlic @ 2009-01-19 23:35 UTC (permalink / raw)
  To: Ted Pavlic; +Cc: catalin.marinas, git
In-Reply-To: <497509A2.5020101@tedpavlic.com>

>> +# Use __stg for stg completion and bail out to normal bash completion
>> +complete -o bashdefault -o default -F __stg stg 2>/dev/null \
>> +    || complete -o default -F __stg stg
>
> Somehow I didn't see the existing
>
> 	stgit-completion.bash

I didn't see it because it is generated in the build process. :(

Sorry for the bother --
Ted

-- 
Ted Pavlic <ted@tedpavlic.com>

   Please visit my ALS association page:
         http://web.alsa.org/goto/tedpavlic
   My family appreciates your support in the fight to defeat ALS.

^ permalink raw reply

* Re: [PATCH v4 0/7] customizable --color-words
From: Johannes Schindelin @ 2009-01-19 23:35 UTC (permalink / raw)
  To: Santi Béjar
  Cc: Thomas Rast, git, Junio C Hamano, Boyd Stephen Smith Jr.,
	Teemu Likonen
In-Reply-To: <adf1fd3d0901191447n7fc39dect9cf5afd88a02015b@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1310 bytes --]

Hi,

On Mon, 19 Jan 2009, Santi Béjar wrote:

> 2009/1/17 Thomas Rast <trast@student.ethz.ch>:
> > Johannes Schindelin (4):
> >  Add color_fwrite_lines(), a function coloring each line individually
> >  color-words: refactor word splitting and use ALLOC_GROW()
> >  color-words: change algorithm to allow for 0-character word
> >    boundaries
> >  color-words: take an optional regular expression describing words
> >
> > Thomas Rast (3):
> >  color-words: enable REG_NEWLINE to help user
> >  color-words: expand docs with precise semantics
> >  color-words: make regex configurable via attributes
> >
> 
> Also, having a config (diff.color-words?) to set the default regexp
> would be great. Thanks.

>From "git log --author==Santi --stat" it seems that you are quite capable 
of providing that patch.

A few pointers:

- Add a global variable to diff.c, maybe "char *diff_word_regex".  
  (Maybe it should be static instead, as it will be used in diff.c only.)

- Add code to set it in diff.c, function git_diff_ui_config().

- In diff.c, where "--color-words" is handled (without "="), add

	if (diff_words_regex)
		options->word_regex = diff_word_regex;

- Add a test to t4034 that tests that the config sets a default, and that 
  the command line can override it.

- Send to this list :-)

Ciao,
Dscho

^ permalink raw reply

* [PATCH] contrib/difftool: change trap condition from SIGINT to INT
From: Markus Heidelberg @ 2009-01-19 23:38 UTC (permalink / raw)
  To: David Aguilar; +Cc: Junio C Hamano, git

git-difftool worked for me on an up-to-date Gentoo Linux at home, but
didn't work on a somewhat older Ubuntu Linux 7.10 at work and failed
with the following error, where 'Makefile' was locally modified:

    trap: 244: SIGINT: bad trap
    external diff died, stopping at Makefile.

In 'man 1p trap' there is written:

    "The condition can be EXIT, 0 (equivalent to EXIT), or a signal
    specified using a symbolic name, without the SIG prefix, [...]"

    "Implementations may permit names with the SIG prefix or ignore case
    in signal names as an extension."

So now we do it the POSIX compliant way instead of using an extension.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 contrib/difftool/git-difftool-helper |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
index f013726..a2eb59b 100755
--- a/contrib/difftool/git-difftool-helper
+++ b/contrib/difftool/git-difftool-helper
@@ -53,7 +53,7 @@ launch_merge_tool () {
 
 	# Create and ensure that we clean up $BACKUP
 	test -f "$MERGED" && cp -- "$MERGED" "$BACKUP"
-	trap sigint_handler SIGINT
+	trap sigint_handler INT
 
 	# $LOCAL and $REMOTE are temporary files so prompt
 	# the user with the real $MERGED name before launching $merge_tool.
-- 
1.6.1.216.g3acd

^ permalink raw reply related

* Re: [PATCH] Provide pessimistic defaults for cross compilation tests.
From: Johannes Schindelin @ 2009-01-19 23:39 UTC (permalink / raw)
  To: Ralf Wildenhues; +Cc: Julius Naperkowski, git
In-Reply-To: <20090119203400.GA3539@ins.uni-bonn.de>

Hi,

On Mon, 19 Jan 2009, Ralf Wildenhues wrote:

> In a cross compile setup, configure tests that run programs
> cannot be executed; in that case, provide pessimistic default
> values.

You may want to note in the subject that this patch is about configure.

How do you deal with the hardcoded limitation that uname_S is defined to 
be the output of "uname -s" on the _build_ system, and that quite a large 
part of the Makefile sets variables dependent on this?

IOW are you certain that configure (with your patch) will override _all_ 
uname_S dependent settings?

Ciao,
Dscho

^ permalink raw reply

* [PATCH] contrib/difftool: remove distracting 'echo' in the SIGINT handler
From: Markus Heidelberg @ 2009-01-19 23:41 UTC (permalink / raw)
  To: David Aguilar; +Cc: Junio C Hamano, git

When interrupting git-difftool with Ctrl-C, the output of this echo
command led to having the cursor at the beginning of the line below the
shell prompt.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---

	David, have you intentionally added this 'echo', did it fix
	anything for you?

 contrib/difftool/git-difftool-helper |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/contrib/difftool/git-difftool-helper b/contrib/difftool/git-difftool-helper
index a2eb59b..0c48506 100755
--- a/contrib/difftool/git-difftool-helper
+++ b/contrib/difftool/git-difftool-helper
@@ -32,7 +32,6 @@ cleanup_temp_files () {
 
 # This is called when users Ctrl-C out of git-difftool-helper
 sigint_handler () {
-	echo
 	cleanup_temp_files
 	exit 1
 }
-- 
1.6.1.216.g3acd

^ permalink raw reply related

* Re: [PATCH,v2] git-checkout(1): mention fate of extraneous files
From: Johannes Schindelin @ 2009-01-19 23:42 UTC (permalink / raw)
  To: Boyd Stephen Smith Jr.; +Cc: jidanni, gitster, git, markus.heidelberg
In-Reply-To: <200901191716.59373.bss@iguanasuicide.net>

Hi,

On Mon, 19 Jan 2009, Boyd Stephen Smith Jr. wrote:

> I think you mean "No untracked content is removed,...".

As "checkout" is about switching branches, and as Git is very keen on 
avoiding loss of uncommitted changes, I think this comment is utterly 
unnecessary.  Indeed, it is rather annoying: when I read a document the 
other day, that I _had_ to read, and which was full of obvious statements, 
sure enough, I missed the single important half-sentence.

IOW do not clutter the man page with distracting stuff, please, please, 
please.

Ciao,
Dscho

^ permalink raw reply

* [PATCH] use uppercase POSIX compliant signals for the 'trap' command
From: Markus Heidelberg @ 2009-01-19 23:43 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

In 'man 1p trap' there is written:

    "Implementations may permit names with the SIG prefix or ignore case
    in signal names as an extension."

So change the lowercase signals to uppercase, which is POSIX compliant
instead of being an extension.

There wasn't anybody claiming that it doesn't work, but there was a bug
with using a signal with the SIG prefix, which is an extension as well.
So let's play it safe and change it, since it doesn't hurt anyone.

While at it, also convert 8 indentation spaces to 1 tab character.

Signed-off-by: Markus Heidelberg <markus.heidelberg@web.de>
---
 t/lib-httpd.sh |   10 +++++-----
 t/test-lib.sh  |   10 +++++-----
 2 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 6ac312b..3824020 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -20,9 +20,9 @@ HTTPD_DOCUMENT_ROOT_PATH=$HTTPD_ROOT_PATH/www
 
 if ! test -x "$LIB_HTTPD_PATH"
 then
-        say "skipping test, no web server found at '$LIB_HTTPD_PATH'"
-        test_done
-        exit
+	say "skipping test, no web server found at '$LIB_HTTPD_PATH'"
+	test_done
+	exit
 fi
 
 HTTPD_VERSION=`$LIB_HTTPD_PATH -v | \
@@ -84,7 +84,7 @@ prepare_httpd() {
 start_httpd() {
 	prepare_httpd
 
-	trap 'stop_httpd; die' exit
+	trap 'stop_httpd; die' EXIT
 
 	"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
 		-f "$TEST_PATH/apache.conf" $HTTPD_PARA \
@@ -92,7 +92,7 @@ start_httpd() {
 }
 
 stop_httpd() {
-	trap 'die' exit
+	trap 'die' EXIT
 
 	"$LIB_HTTPD_PATH" -d "$HTTPD_ROOT_PATH" \
 		-f "$TEST_PATH/apache.conf" -k stop
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 22ed448..41d5a59 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -127,7 +127,7 @@ fi
 
 error () {
 	say_color error "error: $*"
-	trap - exit
+	trap - EXIT
 	exit 1
 }
 
@@ -163,7 +163,7 @@ die () {
 	exit 1
 }
 
-trap 'die' exit
+trap 'die' EXIT
 
 # The semantics of the editor variables are that of invoking
 # sh -c "$EDITOR \"$@\"" files ...
@@ -208,7 +208,7 @@ test_failure_ () {
 	say_color error "FAIL $test_count: $1"
 	shift
 	echo "$@" | sed -e 's/^/	/'
-	test "$immediate" = "" || { trap - exit; exit 1; }
+	test "$immediate" = "" || { trap - EXIT; exit 1; }
 }
 
 test_known_broken_ok_ () {
@@ -416,7 +416,7 @@ test_create_repo () {
 }
 
 test_done () {
-	trap - exit
+	trap - EXIT
 	test_results_dir="$TEST_DIRECTORY/test-results"
 	mkdir -p "$test_results_dir"
 	test_results_path="$test_results_dir/${0%-*}-$$"
@@ -493,7 +493,7 @@ fi
 test="trash directory.$(basename "$0" .sh)"
 test ! -z "$debug" || remove_trash="$TEST_DIRECTORY/$test"
 rm -fr "$test" || {
-	trap - exit
+	trap - EXIT
 	echo >&5 "FATAL: Cannot prepare test area"
 	exit 1
 }
-- 
1.6.1.216.g3acd

^ permalink raw reply related

* Re: [PATCH] commit: more compact summary and without extra quotes
From: Johannes Schindelin @ 2009-01-19 23:46 UTC (permalink / raw)
  To: Santi Béjar; +Cc: git
In-Reply-To: <1232405116-2359-1-git-send-email-santi@agolina.net>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 645 bytes --]

Hi,

On Mon, 19 Jan 2009, Santi Béjar wrote:

> Original:
> [master]: created d9a5491: "foo:bar"
> 
> While with the patch it becomes:
> [master d9a5491] foo:bar

Maybe you want to mention that it saves screen estate.  After all, the 
commit message is _the_ place to relate your motivation to the gentle 
reader.

> As discussed in the git mailing list:
> 
> http://marc.info/?l=git&m=122765031208922&w=2
> 
> Signed-off-by: Santi Béjar <santi@agolina.net>
> ---

You really want to move the link after the ---.  I often read commit 
messages off-line, and let me tell you: I am not really happy reading 
links then.  Not at all.

Ciao,
Dscho

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox