* Re: pull into dirty working tree
From: Nicolas Pitre @ 2007-06-14 14:25 UTC (permalink / raw)
To: Steven Grimm; +Cc: Junio C Hamano, Linus Torvalds, Bill Lear, git
In-Reply-To: <4670F6FD.4060704@midwinter.com>
On Thu, 14 Jun 2007, Steven Grimm wrote:
> You can view this in terms of being a leg up for people who *do* want to use
> git, but are in environments where they are unable to convince or force
> everyone else to adopt git-style workflows. I think it's telling that almost
> all the discussions about this kind of feature are of the form, "I'm trying to
> convince my team to use git, and they find it no good because of X." It's the
> person trying to sell git to the group, presumably so they can use it
> themselves without having to go through a CVS or Subversion or p4 gateway,
> that this stuff really helps. That the rest of the team will benefit down the
> road too is nice but probably not the immediate selfish personal goal of the
> people who are asking for this kind of feature.
Personally, I think there is a point where it isn't worth trying to
convert the world. If people consider GIT bad and unwilling to use it
because of X or Z then they probably better stay with CVS. There is a
limit to how backward bending should GIT do to accomodate everyone,
especially if it is about compromize in its usage model just to make
life easier for people who want to preserve their inferior work flow.
This being said, I don't claim to have a particular opinion about the
issue discussed in this thread. Simply that things should be decided on
a technical basis and be justified with good arguments. Saying that "I
can't convince my co-workers to use GIT if it doesn't do X" is _not_ a
good argument.
Nicolas
^ permalink raw reply
* Re: git-cvsimport cannot handle zsh CVS repo
From: Gerrit Pape @ 2007-06-14 13:25 UTC (permalink / raw)
To: git, 426617
In-Reply-To: <46a038f90706071219h35d776d2m15a9dcf7f9bc24aa@mail.gmail.com>
On Fri, Jun 08, 2007 at 07:19:14AM +1200, Martin Langhoff wrote:
> On 6/7/07, Gerrit Pape <pape@smarden.org> wrote:
> >Hi, I'm stuck tracking down this issue, unfortunately reproducing it
> >seems to take ages. Any help would be appreciated.
> >
> >Please see http://bugs.debian.org/426617
>
> This is probably a problem with cvsps output on that repo. If you run
> cvsps against the cvs repo, what does its output look like around/past
> patchset 6965
>
> There's a number of things that can confuse cvsps, as the cvs repo
> format is horrid.
Hi, the cvsps output is attached to the bug report
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=426617;msg=72;filename=%3Apserver%3Aanonymous%40zsh.cvs.sourceforge.net%3A%23cvsroot%23zsh%23zsh;att=1
Does this help to track down and hopefully fix the problem?
Thanks, Gerrit.
^ permalink raw reply
* [PATCH] Small regresson when series file is empty.
From: Pierre Habouzit @ 2007-06-14 13:20 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
guilt | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/guilt b/guilt
index f77c050..58df606 100755
--- a/guilt
+++ b/guilt
@@ -246,8 +246,9 @@ head_check()
# usage: series_insert_patch <patchname>
series_insert_patch()
{
- awk -v top="`get_top`" -v new="$1" '{
- if (top == "" && NR == 1) print new;
+ awk -v top="`get_top`" -v new="$1" \
+ 'BEGIN{if (top == "") print new;}
+ {
print $0;
if (top != "" && top == $0) print new;
}' "$series" > "$series.tmp"
--
1.5.2.1
^ permalink raw reply related
* Re: [PATCH guilt] make guilt use standard POSIX shell
From: Pierre Habouzit @ 2007-06-14 13:07 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
[-- Attachment #1: Type: text/plain, Size: 587 bytes --]
On Thu, Jun 14, 2007 at 02:50:55PM +0200, Pierre Habouzit wrote:
> This patch series makes guilt be able to work with a standard posix shell.
>
> This has been tested with bash, zsh, dash and posh acting as /bin/sh.
By tested I mean that I carefully crafted the changes, and ran make
test with /bin/sh pointing to those shells, and the suite passed.
Though, we could have /some/ regressions.
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* [PATCH] Easy commands, without bashisms.
From: Pierre Habouzit @ 2007-06-14 12:51 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
Just move to /bin/sh and use . `dirname $0`/guilt as posh fails else.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
guilt-applied | 4 ++--
guilt-delete | 4 ++--
guilt-fold | 4 ++--
| 4 ++--
guilt-init | 4 ++--
guilt-pop | 4 ++--
guilt-prev | 4 ++--
guilt-rebase | 4 ++--
guilt-refresh | 4 ++--
guilt-rm | 4 ++--
guilt-top | 4 ++--
11 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/guilt-applied b/guilt-applied
index 373e5f7..52f8470 100755
--- a/guilt-applied
+++ b/guilt-applied
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[-c]"
-. guilt
+. `dirname $0`/guilt
case $# in
0)
diff --git a/guilt-delete b/guilt-delete
index 8649875..1118b00 100755
--- a/guilt-delete
+++ b/guilt-delete
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[-f] <patchname>"
-. guilt
+. `dirname $0`/guilt
case $# in
1)
diff --git a/guilt-fold b/guilt-fold
index 0d0222b..92fac1a 100755
--- a/guilt-fold
+++ b/guilt-fold
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="<patchname>"
-. guilt
+. `dirname $0`/guilt
if [ $# -ne 1 ]; then
usage
--git a/guilt-header b/guilt-header
index eb89cfd..d07e2be 100755
--- a/guilt-header
+++ b/guilt-header
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[<patchname>]"
-. guilt
+. `dirname $0`/guilt
if [ $# -gt 1 ]; then
usage
diff --git a/guilt-init b/guilt-init
index feacf95..ffe2434 100755
--- a/guilt-init
+++ b/guilt-init
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
@@ -6,7 +6,7 @@
DO_NOT_CHECK_BRANCH_EXISTENCE=1
USAGE="[-n]"
-. guilt
+. `dirname $0`/guilt
autotag=1
diff --git a/guilt-pop b/guilt-pop
index 2b9c2ec..89ad021 100755
--- a/guilt-pop
+++ b/guilt-pop
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[-f] [-a | --all | <patchname>]"
-. guilt
+. `dirname $0`/guilt
while [ $# -gt 0 ]; do
case "$1" in
diff --git a/guilt-prev b/guilt-prev
index 5348f88..26e7a51 100755
--- a/guilt-prev
+++ b/guilt-prev
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE=""
-. guilt
+. `dirname $0`/guilt
if [ $# -ne 0 ]; then
usage
diff --git a/guilt-rebase b/guilt-rebase
index 823384d..cc8dcf6 100755
--- a/guilt-rebase
+++ b/guilt-rebase
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2007
#
@@ -6,7 +6,7 @@
#
USAGE="<upstream>"
-. guilt
+. `dirname $0`/guilt
case "$#" in
1)
diff --git a/guilt-refresh b/guilt-refresh
index 957f23d..8541484 100755
--- a/guilt-refresh
+++ b/guilt-refresh
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE=""
-. guilt
+. `dirname $0`/guilt
if [ $# -ne 0 ]; then
usage
diff --git a/guilt-rm b/guilt-rm
index f0025b4..0ec120d 100755
--- a/guilt-rm
+++ b/guilt-rm
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="<file>..."
-. guilt
+. `dirname $0`/guilt
if [ $# -lt 1 ]; then
usage
diff --git a/guilt-top b/guilt-top
index 3d407e8..8004f10 100755
--- a/guilt-top
+++ b/guilt-top
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE=""
-. guilt
+. `dirname $0`/guilt
if [ $# -ne 0 ]; then
usage
--
1.5.2.1
^ permalink raw reply related
* [PATCH] Remove last bashisms from remaining commands.
From: Pierre Habouzit @ 2007-06-14 12:51 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
Especially also simplify the (quite sloppy) loops to extract ranges of
lines, use sed -n -e '<min>,<max>p' for that.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
guilt-add | 7 +++----
guilt-export | 6 +++---
guilt-files | 6 +++---
guilt-fork | 6 +++---
guilt-graph | 13 +++++++------
guilt-help | 6 +++---
guilt-import | 6 +++---
guilt-import-commit | 6 +++---
guilt-new | 15 ++++++++-------
guilt-next | 6 +++---
guilt-patchbomb | 10 +++++-----
guilt-push | 16 ++++++----------
guilt-series | 6 +++---
guilt-unapplied | 12 +++---------
uninstall | 7 ++-----
15 files changed, 58 insertions(+), 70 deletions(-)
diff --git a/guilt-add b/guilt-add
index fd1e716..ebf41e4 100755
--- a/guilt-add
+++ b/guilt-add
@@ -1,14 +1,13 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="<file>..."
-. guilt
+. `dirname $0`/guilt
if [ $# -lt 1 ]; then
usage
fi
-git-add -- "$@"
-
+exec git-add -- "$@"
diff --git a/guilt-export b/guilt-export
index 444ccdf..2c0a9fd 100755
--- a/guilt-export
+++ b/guilt-export
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Pierre Habouzit, 2007
#
USAGE="[<target_dir>]"
-. guilt
+. `dirname $0`/guilt
if [ $# -gt 1 ]; then
usage
@@ -19,7 +19,7 @@ trap "rm -rf \"$target_dir\"" 0
mkdir -p "$target_dir"
get_series | tee "$target_dir/series" | while read p; do
- mkdir -p "`dirname $target_dir/$p`" 2> /dev/null || true
+ silent mkdir -p "`dirname $target_dir/$p`" || true
cp "$GUILT_DIR/$branch/$p" "$target_dir/$p"
done
diff --git a/guilt-files b/guilt-files
index bc06f39..3428be4 100755
--- a/guilt-files
+++ b/guilt-files
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (C) 2007 Yasushi SHOJI <yashi@atmark-techno.com>
#
USAGE="[-v] [-a] [-l]"
-. guilt
+. `dirname $0`/guilt
opt_verbose=
opt_all=
@@ -26,7 +26,7 @@ do
done
IFS=:
-if [ $opt_all ]; then
+if [ -n "$opt_all" ]; then
cat $applied
else
tail -1 $applied
diff --git a/guilt-fork b/guilt-fork
index 426a7e7..32b31dc 100755
--- a/guilt-fork
+++ b/guilt-fork
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2007
#
USAGE="[<new_name>]"
-. guilt
+. `dirname $0`/guilt
if [ $# -gt 1 ]; then
usage
@@ -28,7 +28,7 @@ else
| sed -r -e 's:(\.diff?|\.patch)$::')
num=$(echo "$base" | sed -nre 's:.*-([0-9]+)$:\1:'p)
[ -n "$num" ] || num=1
- newpatch="${base%-$num}-$((num+1))${patch#$base}"
+ newpatch="${base%-$num}-$(($num+1))${patch#$base}"
fi
if [ -e "$GUILT_DIR/$branch/$newpatch" ]; then
diff --git a/guilt-graph b/guilt-graph
index 5d67040..0c6b890 100755
--- a/guilt-graph
+++ b/guilt-graph
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2007
#
USAGE="[<patchname>]"
-. guilt
+. `dirname $0`/guilt
if [ $# -gt 1 ]; then
usage
@@ -24,13 +24,14 @@ else
fi
fi
-function getfiles
+getfiles()
{
git-diff-tree -r "$1^" "$1" | tr '\t' ' ' | cut -d' ' -f6
}
cache="$GUILT_DIR/$branch/.graphcache.$$"
mkdir "$cache"
+trap "rm -rf \"$cache\"" 0
echo "digraph G {"
@@ -39,7 +40,7 @@ current="$top"
while [ "$current" != "$base" ]; do
echo "# checking rev $current"
- echo -n '' > "$cache/dep"
+ touch "$cache/dep"
getfiles $current | while read f; do
# hash the filename
@@ -51,7 +52,7 @@ while [ "$current" != "$base" ]; do
echo "$current" > "$cache/$fh"
done
- cat "$cache/dep" | sort | uniq | while read h; do
+ sort -u "$cache/dep" | while read h; do
echo " \"${h:0:8}\" -> \"${current:0:8}\"; // ?"
done
@@ -60,4 +61,4 @@ done
echo "}"
-rm -rf "$cache"
+trap - 0
diff --git a/guilt-help b/guilt-help
index 5f867b4..274246b 100755
--- a/guilt-help
+++ b/guilt-help
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2007
#
@@ -6,7 +6,7 @@
DO_NOT_CHECK_BRANCH_EXISTENCE=1
USAGE="[<command> | <topic>]"
-. guilt
+. `dirname $0`/guilt
case $# in
0)
@@ -24,4 +24,4 @@ case $# in
;;
esac
-man "$page"
+exec man "$page"
diff --git a/guilt-import b/guilt-import
index 0e4e037..da3ece8 100755
--- a/guilt-import
+++ b/guilt-import
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2007
#
USAGE="[-P <patch> ] <patch_file>"
-. guilt
+. `dirname $0`/guilt
case "$1" in
-P)
@@ -17,7 +17,7 @@ case "$1" in
;;
esac
-if [ $# -lt 1 -o $# -gt 3 -o -z "$newname" -o -z "$oldname" ]; then
+if [ $# -lt 1 ] || [ $# -gt 3 ] || [ -z "$newname" ] || [ -z "$oldname" ]; then
usage
fi
diff --git a/guilt-import-commit b/guilt-import-commit
index 47f0dc0..6aa65e5 100755
--- a/guilt-import-commit
+++ b/guilt-import-commit
@@ -1,12 +1,12 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2007
#
USAGE="[<hash> | <since>..[<until>] | ..<until>]"
-. guilt
+. `dirname $0`/guilt
-if [ $# -ne 1 -o -z "$1" ]; then
+if [ $# -ne 1 ] || [ -z "$1" ]; then
die "You must specify a range of commits"
fi
diff --git a/guilt-new b/guilt-new
index 7a89b42..5c7eb39 100755
--- a/guilt-new
+++ b/guilt-new
@@ -1,12 +1,12 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[-f] [-s] [-e|-m message] <patchname>"
-. guilt
+. `dirname $0`/guilt
-if [ $# -lt 1 -o $# -gt 4 ]; then
+if [ $# -lt 1 ] || [ $# -gt 4 ]; then
usage
fi
@@ -80,10 +80,11 @@ mkdir_dir=`dirname "$GUILT_DIR/$branch/$patch"`
[ "$edit" = "t" ] && $editor "$GUILT_DIR/$branch/$patch"
if [ ! -z "$force" ]; then
- cd "$TOP_DIR"
- git-diff HEAD >> "$GUILT_DIR/$branch/$patch"
- git-reset --hard HEAD > /dev/null
- cd -
+ (
+ cd "$TOP_DIR"
+ git-diff HEAD >> "$GUILT_DIR/$branch/$patch"
+ git-reset --hard HEAD > /dev/null
+ )
fi
# insert the patch name into the series file
diff --git a/guilt-next b/guilt-next
index b25c761..f38f1cc 100755
--- a/guilt-next
+++ b/guilt-next
@@ -1,17 +1,17 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE=""
-. guilt
+. `dirname $0`/guilt
if [ $# -ne 0 ]; then
usage
fi
n=`wc -l < $applied`
-n=`expr $n + 1`
+n=$(($n + 1))
get_series | awk "{ if (NR == $n) print \$0}"
diff --git a/guilt-patchbomb b/guilt-patchbomb
index c1c3ea0..5001d47 100755
--- a/guilt-patchbomb
+++ b/guilt-patchbomb
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2007
#
@@ -6,7 +6,7 @@
DO_NOT_CHECK_BRANCH_EXISTENCE=1
USAGE="[-n] [--in-reply-to <msgid>] [<hash> | <since>..[<until>] | ..<until>]"
-. guilt
+. `dirname $0`/guilt
while [ $# -gt 0 ]; do
case "$1" in
@@ -34,7 +34,7 @@ git-log --pretty=oneline "$r" | cut -c 1-8,41- | $pager
echo -n "Are these what you want to send? [Y/n] "
read n
-if [ "$n" = "n" -o "$n" = "N" ]; then
+if [ "$n" = "n" ] || [ "$n" = "N" ]; then
die "Aborting..."
fi
@@ -72,7 +72,7 @@ opts="$opts $to_opts"
# last possible point to abort!
echo -n "Proceed with patchbomb (this is the last chance to abort)? [y/N] "
read n
-if [ "$n" != "y" -a "$n" != "Y" ]; then
+if [ "$n" != "y" ] && [ "$n" != "Y" ]; then
die "Aborting..."
fi
@@ -93,5 +93,5 @@ fi
echo -n "Delete temporary directory? [Y/n] "
read n
-[ "$n" = "n" -o "$n" = "N" ] && exit 0
+[ "$n" = "n" ] || [ "$n" = "N" ] && exit 0
rm -rf $dir
diff --git a/guilt-push b/guilt-push
index c7d8355..ad3616b 100755
--- a/guilt-push
+++ b/guilt-push
@@ -1,15 +1,15 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[ -f ] [-a | --all | <patchname>]"
-. guilt
+. `dirname $0`/guilt
abort_flag="abort"
-if [ "$1" == "-f" ]; then
+if [ "$1" = "-f" ]; then
abort_flag=""
shift
fi
@@ -20,7 +20,7 @@ fi
patch="$1"
-if [ "$patch" = "--all" -o "$patch" = "-a" ]; then
+if [ "$patch" = "--all" ] || [ "$patch" = "-a" ]; then
# we are supposed to push all patches, get the last one out of
# series
@@ -52,12 +52,8 @@ fi
sidx=`wc -l < $applied`
sidx=`expr $sidx + 1`
-idx=0
-for p in `get_series`; do
- idx=`expr $idx + 1`
- [ $idx -lt $sidx ] && continue
- [ $idx -gt $eidx ] && break
-
+get_series | sed -n -e "${sidx},${eidx}p" | while read p
+do
echo "Applying patch..$p"
if [ ! -f "$GUILT_DIR/$branch/$p" ]; then
die "Patch $patch does not exist. Aborting."
diff --git a/guilt-series b/guilt-series
index af1c8f2..efb11c2 100755
--- a/guilt-series
+++ b/guilt-series
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[-v]"
-. guilt
+. `dirname $0`/guilt
while case "$#" in 0) break ;; esac
do
@@ -17,7 +17,7 @@ do
shift
done
-if ! [ $verbose ]; then
+if ! [ -n "$verbose" ]; then
get_series
else
prefix="+"
diff --git a/guilt-unapplied b/guilt-unapplied
index 5bbe4d8..192a7e5 100755
--- a/guilt-unapplied
+++ b/guilt-unapplied
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE=""
-. guilt
+. `dirname $0`/guilt
if [ $# -ne 0 ]; then
usage
@@ -13,10 +13,4 @@ fi
n=`wc -l < $applied`
n=`expr $n + 1`
-idx=0
-for p in `get_series`; do
- idx=`expr $idx + 1`
- [ $idx -lt $n ] && continue
-
- echo $p
-done
+get_series | sed -n -e "$n,\$p"
diff --git a/uninstall b/uninstall
index 54c6d26..9c8a3b7 100755
--- a/uninstall
+++ b/uninstall
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) 2007 Nur Hussein <hussein@cs.usm.my>
#
@@ -12,7 +12,4 @@ PRE=$1
shift
-for x in "$@"
-do
- rm "$PRE/$x"
-done
+(cd $PRE; rm "$@")
--
1.5.2.1
^ permalink raw reply related
* [PATCH] guilt-status(1): Remove bashisms.
From: Pierre Habouzit @ 2007-06-14 12:51 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
guilt-status | 58 ++++++++++++++++++++++++++++------------------------------
1 files changed, 28 insertions(+), 30 deletions(-)
diff --git a/guilt-status b/guilt-status
index 934ea53..bc2f33e 100755
--- a/guilt-status
+++ b/guilt-status
@@ -1,10 +1,10 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
USAGE="[-a|-A] [-c|-C] [-d|-D] [-m|-M] [-r|-R] [-t|-T] [-u|-U] [-x|-X] [-n]"
-. guilt
+. `dirname $0`/guilt
untracked=""
DIFF_FILTER=""
@@ -53,7 +53,7 @@ fi
git-rev-parse --verify HEAD >/dev/null 2>&1 || IS_INITIAL=t
-function print_status
+print_status()
{
if [ -z "$no_prefix" ] ; then
Apfx="A "
@@ -81,34 +81,32 @@ function print_status
done
}
-cd "$TOP_DIR"
-
(
-# untracked; FIXME: there's got to be a better way
-if [ ! -z "$untracked" ]; then
- if [ -f "$GIT_DIR/info/exclude" ]; then
- git-ls-files -z --others \
- --exclude-from="$GIT_DIR/info/exclude" \
- --exclude-per-directory=.gitignore
- else
- git-ls-files -z --others --exclude-per-directory=.gitignore
- fi | xargs -0 -L 1 echo | while read n; do
- [ -z "$n" ] && continue
- echo "$n" | sed -e "s/^/?\t/"
- done
-fi
+ cd "$TOP_DIR"
+ # untracked; FIXME: there's got to be a better way
+ if [ ! -z "$untracked" ]; then
+ if [ -f "$GIT_DIR/info/exclude" ]; then
+ git-ls-files -z --others \
+ --exclude-from="$GIT_DIR/info/exclude" \
+ --exclude-per-directory=.gitignore
+ else
+ git-ls-files -z --others --exclude-per-directory=.gitignore
+ fi | xargs -0 -L 1 echo | while read n; do
+ [ -z "$n" ] && continue
+ echo "$n" | sed -e "s/^/?\t/"
+ done
+ fi
-# added
-if [ -z "$IS_INITIAL" ]; then
- # non-initial commit
- git-diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD
-else
- # initial commit
- git-ls-files | sed -e "s/^/A\t/"
-fi | sed -e '
- s/\\/\\\\/g
- s/ /\\ /g
-'
+ # added
+ if [ -z "$IS_INITIAL" ]; then
+ # non-initial commit
+ git-diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD
+ else
+ # initial commit
+ git-ls-files | sed -e "s/^/A\t/"
+ fi | sed -e '
+ s/\\/\\\\/g
+ s/ /\\ /g
+ '
) | print_status
-cd - 2>&1 >/dev/null
--
1.5.2.1
^ permalink raw reply related
* [PATCH] guilt(1): reimplement push_patch, using a subshell to avoid locals.
From: Pierre Habouzit @ 2007-06-14 12:50 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
this is a bit ugly, but makes the code really shorter, and more readable
anyway. We still need the old bail variable, named __push_patch_bail to
avoid spurious collisions (we are not recursing into ourselves, so it's
safe).
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
guilt | 133 ++++++++++++++++++++++++-----------------------------------------
1 files changed, 49 insertions(+), 84 deletions(-)
diff --git a/guilt b/guilt
index 44273f3..f77c050 100755
--- a/guilt
+++ b/guilt
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/sh
#
# Copyright (c) Josef "Jeff" Sipek, 2006, 2007
#
@@ -341,106 +341,71 @@ update_stack_tags()
# usage: push_patch patchname [bail_action]
push_patch()
{
- local p="$GUILT_DIR/$branch/$1"
- local pname="$1"
- local bail_action="$2"
+ __push_patch_bail=0
- local bail=0
- local reject="--reject"
-
- assert_head_check
-
- cd "$TOP_DIR"
+ (
+ p="$GUILT_DIR/$branch/$1"
+ pname="$1"
+ bail_action="$2"
+ reject="--reject"
- # apply the patch if and only if there is something to apply
- if [ `git-apply --numstat "$p" | wc -l` -gt 0 ]; then
- if [ "$bail_action" = abort ]; then
- reject=""
- fi
- git-apply -C$guilt_push_diff_context \
- $reject "$p" > /dev/null 2> /tmp/guilt.log.$$
- bail=$?
+ assert_head_check
+ cd "$TOP_DIR"
- if [ $bail -ne 0 ]; then
- cat /tmp/guilt.log.$$ >&2
+ # apply the patch if and only if there is something to apply
+ if [ `git-apply --numstat "$p" | wc -l` -gt 0 ]; then
if [ "$bail_action" = abort ]; then
- return $bail
+ reject=""
+ fi
+ git-apply -C$guilt_push_diff_context \
+ $reject "$p" > /dev/null 2> /tmp/guilt.log.$$
+ __push_patch_bail=$?
+
+ if [ $__push_patch_bail -ne 0 ]; then
+ cat /tmp/guilt.log.$$ >&2
+ if [ "$bail_action" = "abort" ]; then
+ rm -f /tmp/guilt.log.$$ /tmp/guilt.msg.$$
+ return $__push_patch_bail
+ fi
fi
- fi
-
- # FIXME: Path munging is being done, we need to convince
- # git-apply to just give us list of files with \0 as a
- # delimiter, and pass -z to git-update-index
- git-apply --numstat "$p" | cut -f 3- | git-update-index --add --remove --stdin
- fi
- # grab a commit message out of the patch
- do_get_header "$p" > /tmp/guilt.msg.$$
+ # FIXME: Path munging is being done, we need to convince
+ # git-apply to just give us list of files with \0 as a
+ # delimiter, and pass -z to git-update-index
+ git-apply --numstat "$p" | cut -f 3- | git-update-index --add --remove --stdin
+ fi
- # make a default commit message if patch doesn't contain one
- [ ! -s /tmp/guilt.msg.$$ ] && echo "patch $pname" > /tmp/guilt.msg.$$
+ # grab a commit message out of the patch
+ do_get_header "$p" > /tmp/guilt.msg.$$
- # extract a From line from the patch header, and set
- # GIT_AUTHOR_{NAME,EMAIL}
- local author_str=`cat "$p" | grep -e '^From: ' | sed -e 's/^From: //'`
- if [ ! -z "$author_str" ]; then
- local backup_author_name="$GIT_AUTHOR_NAME"
- local backup_author_email="$GIT_AUTHOR_EMAIL"
- GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
- GIT_AUTHOR_EMAIL=`echo $author_str | sed -e 's/[^<]*//'`
+ # make a default commit message if patch doesn't contain one
+ [ ! -s /tmp/guilt.msg.$$ ] && echo "patch $pname" > /tmp/guilt.msg.$$
- if [ -z "$GIT_AUTHOR_NAME" ]; then
- GIT_AUTHOR_NAME=" "
+ # extract a From line from the patch header, and set
+ # GIT_AUTHOR_{NAME,EMAIL}
+ author_str=`sed -n -e '/^From:/ { s/^From: //; p; q }' "$p"`
+ if [ ! -z "$author_str" ]; then
+ GIT_AUTHOR_NAME=`echo $author_str | sed -e 's/ *<.*$//'`
+ export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME:-" "}"
+ export GIT_AUTHOR_EMAIL="`echo $author_str | sed -e 's/[^<]*//'`"
fi
+ export GIT_AUTHOR_DATE="`stat -c %y "$p"`"
+ export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE"
- export GIT_AUTHOR_NAME GIT_AUTHOR_EMAIL
- fi
- local backup_author_date="$GIT_AUTHOR_DATE"
- local backup_committer_date="$GIT_COMMITTER_DATE"
- export GIT_AUTHOR_DATE=`stat -c %y "$p"`
- export GIT_COMMITTER_DATE=$GIT_AUTHOR_DATE
-
- # commit
- local treeish=`git-write-tree`
- local commitish=`git-commit-tree $treeish -p HEAD < /tmp/guilt.msg.$$`
- echo $commitish > $GIT_DIR/`git-symbolic-ref HEAD`
+ # commit
+ treeish=`git-write-tree`
+ commitish=`git-commit-tree $treeish -p HEAD < /tmp/guilt.msg.$$`
+ echo $commitish > $GIT_DIR/`git-symbolic-ref HEAD`
- # mark patch as applied
- echo "$commitish:$pname" >> $applied
-
- cd - 2>&1 >/dev/null
+ # mark patch as applied
+ echo "$commitish:$pname" >> $applied
+ )
# update references to top, bottom, and base of the stack
update_stack_tags
- # restore original GIT_AUTHOR_{NAME,EMAIL}
- if [ ! -z "$author_str" ]; then
- if [ ! -z "$backup_author_name" ]; then
- export GIT_AUTHOR_NAME="$backup_author_name"
- else
- unset GIT_AUTHOR_NAME
- fi
-
- if [ ! -z "$backup_author_name" ]; then
- export GIT_AUTHOR_EMAIL="$backup_author_email"
- else
- unset GIT_AUTHOR_EMAIL
- fi
- fi
- if [ ! -z "$backup_author_date" ]; then
- export GIT_AUTHOR_DATE="$backup_author_date"
- else
- unset GIT_AUTHOR_DATE
- fi
- if [ ! -z "$backup_committer_date" ]; then
- export GIT_COMMITTER_DATE="$backup_committer_date"
- else
- unset GIT_COMMITTER_DATE
- fi
-
rm -f /tmp/guilt.msg.$$ /tmp/guilt.log.$$
-
- return $bail
+ return $__push_patch_bail
}
# usage: must_commit_first
--
1.5.2.1
^ permalink raw reply related
* [PATCH] guilt(1): Obvious bashisms fixed.
From: Pierre Habouzit @ 2007-06-14 12:50 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
+ function foo { } -> foo() { }
+ add wrapper for echo -e
+ couple of '[' bashisms
+ get rid of easy local variables to remove
+ avoid cd - (using subshells)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
guilt | 185 ++++++++++++++++++++++++++++++++---------------------------------
1 files changed, 91 insertions(+), 94 deletions(-)
diff --git a/guilt b/guilt
index 2ae76f8..80f3faf 100755
--- a/guilt
+++ b/guilt
@@ -20,7 +20,29 @@ SUBDIRECTORY_OK=1
. git-sh-setup
-function guilt_commands
+#
+# Shell library
+#
+
+# echo -e is a bashism, fallback to /bin/echo if the builtin does not supports it
+echo()
+{
+ /bin/echo "$@"
+}
+
+noerr()
+{
+ "$@" 2>/dev/null
+}
+
+silent()
+{
+ "$@" >/dev/null 2>/dev/null
+}
+
+########
+
+guilt_commands()
{
local command
for command in $0-*
@@ -32,7 +54,7 @@ function guilt_commands
done
}
-if [ `basename $0` = "guilt" ]; then
+if [ "`basename $0`" = "guilt" ]; then
# being run as standalone
# by default, we shouldn't fail
@@ -58,7 +80,7 @@ if [ `basename $0` = "guilt" ]; then
esac
done
fi
- if [ $cmd ]; then
+ if [ -n "$cmd" ]; then
shift
exec "$dir/guilt-$cmd" "$@"
@@ -96,68 +118,55 @@ fi
#
# usage: valid_patchname <patchname>
-function valid_patchname
+valid_patchname()
{
- [ `echo "$1" | grep -e '^/' | wc -l` -gt 0 ] && return 1
- [ `echo "$1" | grep -e '^\./' | wc -l` -gt 0 ] && return 1
- [ `echo "$1" | grep -e '^\.\./' | wc -l` -gt 0 ] && return 1
- [ `echo "$1" | grep -e '/\./' | wc -l` -gt 0 ] && return 1
- [ `echo "$1" | grep -e '/\.\./' | wc -l` -gt 0 ] && return 1
- [ `echo "$1" | grep -e '/\.$' | wc -l` -gt 0 ] && return 1
- [ `echo "$1" | grep -e '/\.\.$' | wc -l` -gt 0 ] && return 1
- [ `echo "$1" | grep -e '/$' | wc -l` -gt 0 ] && return 1
- return 0
+ case "$1" in
+ /*|./*|../*|*/./*|*/../*|*/.|*/..|*/)
+ return 1;;
+ *)
+ return 0;;
+ esac
}
-function get_branch
+get_branch()
{
git-symbolic-ref HEAD | sed -e 's,^refs/heads/,,'
}
-function verify_branch
+verify_branch()
{
- local b=$branch
-
[ ! -d "$GIT_DIR/patches" ] &&
echo "Patches directory doesn't exist, try guilt-init" >&2 &&
return 1
- [ ! -d "$GIT_DIR/patches/$b" ] &&
- echo "Branch $b is not initialized, try guilt-init" >&2 &&
+ [ ! -d "$GIT_DIR/patches/$branch" ] &&
+ echo "Branch $branch is not initialized, try guilt-init" >&2 &&
return 1
- [ ! -f "$GIT_DIR/patches/$b/series" ] &&
- echo "Branch $b does not have a series file" >&2 &&
+ [ ! -f "$GIT_DIR/patches/$branch/series" ] &&
+ echo "Branch $branch does not have a series file" >&2 &&
return 1
- [ ! -f "$GIT_DIR/patches/$b/status" ] &&
- echo "Branch $b does not have a status file" >&2 &&
+ [ ! -f "$GIT_DIR/patches/$branch/status" ] &&
+ echo "Branch $branch does not have a status file" >&2 &&
return 1
- [ -f "$GIT_DIR/patches/$b/applied" ] &&
- echo "Warning: Branch $b has 'applied' file - guilt is not compatible with stgit" >&2 &&
+ [ -f "$GIT_DIR/patches/$branch/applied" ] &&
+ echo "Warning: Branch $branch has 'applied' file - guilt is not compatible with stgit" >&2 &&
return 1
return 0
}
-function get_top
+get_top()
{
tail -1 "$GUILT_DIR/$branch/status" | cut -d: -f 2-
}
-function get_prev
+get_prev()
{
- local n=`wc -l < "$GUILT_DIR/$branch/status"`
- local n=`expr $n - 1`
-
- local idx=0
- cat "$GUILT_DIR/$branch/status" | while read p; do
- idx=`expr $idx + 1`
- [ $idx -lt $n ] && continue
- [ $idx -gt $n ] && break
-
- echo "$p"
- done
+ if [ `wc -l < "$GUILT_DIR/$branch/status"` -gt 1 ]; then
+ tail -n 2 "$GUILT_DIR/$branch/status" | head -n 1
+ fi
}
-function get_series
+get_series()
{
# ignore all lines matching:
# - empty lines
@@ -168,7 +177,7 @@ function get_series
}
# usage: do_make_header <hash>
-function do_make_header
+do_make_header()
{
# which revision do we want to work with?
local rev="$1"
@@ -195,7 +204,7 @@ BEGIN{ok=0}
}
# usage: do_get_header patchfile
-function do_get_header
+do_get_header()
{
# The complexity arises from the fact that we want to ignore the
# From line and the empty line after it if it exists
@@ -212,7 +221,7 @@ END{}
}
# usage: do_get_full_header patchfile
-function do_get_full_header
+do_get_full_header()
{
# 2nd line checks for the begining of a patch
# 3rd line outputs the line if it didn't get pruned by the above rules
@@ -225,37 +234,31 @@ END{}
}
# usage: assert_head_check
-function assert_head_check
+assert_head_check()
{
- local eh=`tail -1 < "$applied" | cut -d: -f 1`
-
- if ! head_check "$eh"; then
+ if ! head_check "`tail -1 < "$applied" | cut -d: -f 1`"; then
die "aborting..."
fi
-
- return 0
}
# usage: head_check <expected hash>
-function head_check
+head_check()
{
# make sure we're not doing funky things to commits that don't
# belong to us
- local ch=`cat "$GIT_DIR/refs/heads/$branch"`
-
# if the expected hash is empty, just return
[ -z "$1" ] && return 0
- if [ "$ch" != "$1" ]; then
+ if [ "`cat "$GIT_DIR/refs/heads/$branch"`" != "$1" ]; then
echo "Expected HEAD commit $1" >&2
- echo " got $ch" >&2
+ echo " got `cat "$GIT_DIR/refs/heads/$branch"`" >&2
return 1
fi
return 0
}
# usage: series_insert_patch <patchname>
-function series_insert_patch
+series_insert_patch()
{
local top=`get_top | sed -e 's,/,\\\\/,g'`
local new=`echo "$1" | sed -e 's,/,\\\\/,g'`
@@ -271,14 +274,14 @@ function series_insert_patch
}
# usage: series_remove_patch <patchname>
-function series_remove_patch
+series_remove_patch()
{
grep -v "^$1\$" < "$series" > "$series.tmp"
mv "$series.tmp" "$series"
}
# usage: series_rename_patch <oldname> <newname>
-function series_rename_patch
+series_rename_patch()
{
local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
local new=`echo "$2" | sed -e 's,/,\\\\/,g'`
@@ -290,7 +293,7 @@ function series_rename_patch
# file directly
#
# usage: applied_rename_patch <oldname> <newname>
-function applied_rename_patch
+applied_rename_patch()
{
local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
local new=`echo "$2" | sed -e 's,/,\\\\/,g'`
@@ -299,33 +302,32 @@ function applied_rename_patch
}
# usage: pop_many_patches <commitish> <number of patches>
-function pop_many_patches
+pop_many_patches()
{
assert_head_check
+ (
cd "$TOP_DIR"
git-reset --hard "$1" > /dev/null
head -n "-$2" < "$applied" > "$applied.tmp"
mv "$applied.tmp" "$applied"
-
- cd - 2>&1 >/dev/null
+ )
# update references to top, bottom, and base
update_stack_tags
}
# usage: pop_all_patches
-function pop_all_patches
+pop_all_patches()
{
- local x=`head -1 "$applied" | cut -d: -f1`
- local n=`wc -l < "$applied"`
-
- pop_many_patches $x^ $n
+ pop_many_patches \
+ `head -1 "$applied" | cut -d: -f1`^ \
+ `wc -l < "$applied"`
}
# usage: update_stack_tags
-function update_stack_tags
+update_stack_tags()
{
# bail if autotagging is not enabled
if [ $autotag -eq 0 ]; then
@@ -336,13 +338,9 @@ function update_stack_tags
# there are patches applied, therefore we must get the top,
# bottom and base hashes, and update the tags
- local top_hash=`git-rev-parse HEAD`
- local bottom_hash=`head -1 < $applied | cut -d: -f1`
- local base_hash=`git-rev-parse $bottom_hash^`
-
- echo $top_hash > "$GIT_DIR/refs/tags/${branch}_top"
- echo $bottom_hash > "$GIT_DIR/refs/tags/${branch}_bottom"
- echo $base_hash > "$GIT_DIR/refs/tags/${branch}_base"
+ git-rev-parse HEAD > "$GIT_DIR/refs/tags/${branch}_top"
+ head -1 < $applied | cut -d: -f1 > "$GIT_DIR/refs/tags/${branch}_bottom"
+ git-rev-parse $(head -1 < $applied | cut -d: -f1)^ > "$GIT_DIR/refs/tags/${branch}_base"
else
# there are no patches applied, therefore we must remove the
# tags to old top, bottom, and base
@@ -354,7 +352,7 @@ function update_stack_tags
}
# usage: push_patch patchname [bail_action]
-function push_patch
+push_patch()
{
local p="$GUILT_DIR/$branch/$1"
local pname="$1"
@@ -459,54 +457,53 @@ function push_patch
}
# usage: must_commit_first
-function must_commit_first
+must_commit_first()
{
[ `git-diff-files | wc -l` -eq 0 ]
return $?
}
# usage: fold_patch patchname
-function fold_patch
+fold_patch()
{
- local top_patch=`get_top`
+ set -- "$1" "`get_top`"
assert_head_check
push_patch "$1"
- __refresh_patch "$top_patch" HEAD^^ 2
+ __refresh_patch "$2" HEAD^^ 2
series_remove_patch "$1"
}
# usage: refresh_patch patchname
-function refresh_patch
+refresh_patch()
{
__refresh_patch "$1" HEAD^ 1
}
# usage: __refresh_patch patchname commitish number_of_commits
-function __refresh_patch
+__refresh_patch()
{
- local p="$GUILT_DIR/$branch/$1"
-
assert_head_check
- cd "$TOP_DIR"
-
- git-diff-files --name-only | (while read n; do git-update-index "$n" ; done)
+ (
+ cd "$TOP_DIR"
+ p="$GUILT_DIR/$branch/$1"
- # get the patch header
- do_get_full_header "$p" > /tmp/guilt.diff.$$
+ git-diff-files --name-only | (while read n; do git-update-index "$n" ; done)
- # get the new patch
- git-diff "$2" >> /tmp/guilt.diff.$$
+ # get the patch header
+ do_get_full_header "$p" > /tmp/guilt.diff.$$
- # move the new patch in
- mv "$p" "$p~"
- mv /tmp/guilt.diff.$$ $p
+ # get the new patch
+ git-diff "$2" >> /tmp/guilt.diff.$$
- cd - 2>&1 >/dev/null
+ # move the new patch in
+ mv "$p" "$p~"
+ mv /tmp/guilt.diff.$$ $p
+ )
# drop the currently applied patch, pop_many_patches does it's own
# cd $TOP_DIR
@@ -525,7 +522,7 @@ function __refresh_patch
# <hash1>..<hash2> - from hash to hash (inclusive)
#
# The output of this function is suitable to be passed to git-rev-list
-function munge_hash_range
+munge_hash_range()
{
[ -z "$1" ] && return 1
--
1.5.2.1
^ permalink raw reply related
* [PATCH] Regression test suite needs bash, that's OK.
From: Pierre Habouzit @ 2007-06-14 12:50 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
regression/010-init.sh | 1 +
regression/011-no-repo.sh | 1 +
regression/020-push.sh | 1 +
regression/021-pop.sh | 1 +
regression/022-applied.sh | 1 +
regression/023-top.sh | 1 +
regression/024-unapplied.sh | 1 +
regression/025-new.sh | 1 +
regression/026-delete.sh | 1 +
regression/027-refresh.sh | 1 +
regression/050-series.sh | 1 +
regression/060-files.sh | 1 +
regression/Makefile | 2 +-
13 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/regression/010-init.sh b/regression/010-init.sh
index 17c1c16..1553d0c 100755
--- a/regression/010-init.sh
+++ b/regression/010-init.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the init code
#
diff --git a/regression/011-no-repo.sh b/regression/011-no-repo.sh
index b37a548..fd4f6a5 100755
--- a/regression/011-no-repo.sh
+++ b/regression/011-no-repo.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test that all commands that should fail do indeed fail if the branch was
# not guilt-init'ed
diff --git a/regression/020-push.sh b/regression/020-push.sh
index 0d49a7e..6242529 100755
--- a/regression/020-push.sh
+++ b/regression/020-push.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the push code
#
diff --git a/regression/021-pop.sh b/regression/021-pop.sh
index 418a054..e1af856 100755
--- a/regression/021-pop.sh
+++ b/regression/021-pop.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the pop code
#
diff --git a/regression/022-applied.sh b/regression/022-applied.sh
index 78d00d9..f259bf4 100755
--- a/regression/022-applied.sh
+++ b/regression/022-applied.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the applied code
#
diff --git a/regression/023-top.sh b/regression/023-top.sh
index d490f14..c486448 100755
--- a/regression/023-top.sh
+++ b/regression/023-top.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the top code
#
diff --git a/regression/024-unapplied.sh b/regression/024-unapplied.sh
index 368b3cc..ecb0298 100755
--- a/regression/024-unapplied.sh
+++ b/regression/024-unapplied.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the unapplied code
#
diff --git a/regression/025-new.sh b/regression/025-new.sh
index f17f20e..680f6da 100755
--- a/regression/025-new.sh
+++ b/regression/025-new.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the new code
#
diff --git a/regression/026-delete.sh b/regression/026-delete.sh
index 7c16b38..07c969a 100755
--- a/regression/026-delete.sh
+++ b/regression/026-delete.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the delete code
#
diff --git a/regression/027-refresh.sh b/regression/027-refresh.sh
index 4a3270e..704d0b5 100755
--- a/regression/027-refresh.sh
+++ b/regression/027-refresh.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the refresh code
#
diff --git a/regression/050-series.sh b/regression/050-series.sh
index 437cd2f..eb23540 100755
--- a/regression/050-series.sh
+++ b/regression/050-series.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the series parsing code
#
diff --git a/regression/060-files.sh b/regression/060-files.sh
index 875f991..915c73a 100755
--- a/regression/060-files.sh
+++ b/regression/060-files.sh
@@ -1,3 +1,4 @@
+#!/bin/bash
#
# Test the series parsing code
#
diff --git a/regression/Makefile b/regression/Makefile
index c538029..3dd9d0e 100644
--- a/regression/Makefile
+++ b/regression/Makefile
@@ -1,3 +1,3 @@
.PHONY: all
all:
- (for x in *.sh ; do sh $$x || exit $?; done)
+ set -e; $(foreach x,$(wildcard *.sh),./$x;)
--
1.5.2.1
^ permalink raw reply related
* [PATCH] guilt(1): simplifications...
From: Pierre Habouzit @ 2007-06-14 12:50 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git, Pierre Habouzit
In-Reply-To: <11818254621527-git-send-email-madcoder@debian.org>
+ using awk to avoid local variables
+ more clever with sed
+ reimplement munge_hash_range with case
and some whitespace problems.
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---
guilt | 132 ++++++++++++++++++++++++++++-------------------------------------
1 files changed, 57 insertions(+), 75 deletions(-)
diff --git a/guilt b/guilt
index 80f3faf..44273f3 100755
--- a/guilt
+++ b/guilt
@@ -44,14 +44,7 @@ silent()
guilt_commands()
{
- local command
- for command in $0-*
- do
- if [ -f "$command" -a -x "$command" ]
- then
- echo ${command##$0-}
- fi
- done
+ find "`dirname $0`" -maxdepth 1 -name "guilt-*" -type f -perm /111 | sed -e "s/.*\\/`basename $0`-//"
}
if [ "`basename $0`" = "guilt" ]; then
@@ -97,9 +90,7 @@ if [ "`basename $0`" = "guilt" ]; then
echo "Guilt v$GUILT_VERSION"
echo ""
echo "Pick a command:"
- for x in `dirname $0`/guilt-*; do
- [ -x $x ] && echo -e ${x##$0-}
- done | sort | column | column -t | sed -e $'s/^/\t/'
+ guilt_commands | sort | column | column -t | sed -e 's/^/\t/'
echo ""
echo "Example:"
@@ -173,34 +164,29 @@ get_series()
# - whitespace only
# - optional whitespace followed by '#' followed by more
# optional whitespace
- grep -ve '^[[:space:]]*\(#.*\)*$' < "$series"
+ grep -ve '^[[:space:]]*\(#.*\)*$' "$series"
}
# usage: do_make_header <hash>
do_make_header()
{
- # which revision do we want to work with?
- local rev="$1"
-
# we should try to work with commit objects only
- if [ `git-cat-file -t "$rev"` != "commit" ]; then
- echo "Hash $rev is not a commit object" >&2
+ if [ `git-cat-file -t "$1"` != "commit" ]; then
+ echo "Hash $1 is not a commit object" >&2
echo "Aborting..." >&2
exit 2
fi
- # get the author line from the commit object
- local author=`git-cat-file -p "$rev" | grep -e '^author ' | head -1`
-
- # strip the timestamp & '^author ' string
- author=`echo "$author" | sed -e 's/^author //' -e 's/ [0-9]* [+-]*[0-9][0-9]*$//'`
-
- git-cat-file -p "$rev" | awk "
-BEGIN{ok=0}
-(ok==1){print \$0; print \"\nFrom: $author\"; ok=2; next}
-(ok==2){print \$0}
-/^\$/ && (ok==0){ok=1}
-"
+ git-cat-file -p "$1" | sed -e \
+ '1,/^$/ {
+ /^author/ {
+ s/^author /From: /
+ s/ [0-9]* [+-]*[0-9][0-9]*$//
+ p
+ }
+ /^$/p
+ d
+ }'
}
# usage: do_get_header patchfile
@@ -260,17 +246,12 @@ head_check()
# usage: series_insert_patch <patchname>
series_insert_patch()
{
- local top=`get_top | sed -e 's,/,\\\\/,g'`
- local new=`echo "$1" | sed -e 's,/,\\\\/,g'`
-
- if [ ! -z "$top" ]; then
- sed -i -e "s/^$top\$/$top\n$new/" "$series"
- else
- # don't use $new here as it would only complicate things
- echo "$1" > "$series.tmp"
- cat "$series" >> "$series.tmp"
- mv "$series.tmp" "$series"
- fi
+ awk -v top="`get_top`" -v new="$1" '{
+ if (top == "" && NR == 1) print new;
+ print $0;
+ if (top != "" && top == $0) print new;
+ }' "$series" > "$series.tmp"
+ mv "$series.tmp" "$series"
}
# usage: series_remove_patch <patchname>
@@ -283,10 +264,11 @@ series_remove_patch()
# usage: series_rename_patch <oldname> <newname>
series_rename_patch()
{
- local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
- local new=`echo "$2" | sed -e 's,/,\\\\/,g'`
+ awk -v old="$1" -v new="$2" \
+ '{ if ($0 == old) print new; else print $0 }' \
+ "$series.tmp" > "$series"
- sed -i -e "s/^$old\$/$new/" "$series"
+ mv "$series.tmp" "$series"
}
# Beware! This is one of the few (only?) places where we modify the applied
@@ -295,10 +277,15 @@ series_rename_patch()
# usage: applied_rename_patch <oldname> <newname>
applied_rename_patch()
{
- local old=`echo "$1" | sed -e 's,/,\\\\/,g'`
- local new=`echo "$2" | sed -e 's,/,\\\\/,g'`
+ awk -v old="$1" -v new="$2" \
+ 'BEGIN{FS=":"}
+ { if ($1 ~ /^[0-9a-f]*$/ && length($1) == 40 && substr($0, 42) == old)
+ print substr($0, 0, 41) new;
+ else
+ print;
+ }' "$applied" > "$applied.new"
- sed -i -e "s/^\\([0-9a-f]\\{40\\}\\):$old\$/\\1:$new/" "$applied"
+ mv "$applied.tmp" "$applied"
}
# usage: pop_many_patches <commitish> <number of patches>
@@ -307,11 +294,11 @@ pop_many_patches()
assert_head_check
(
- cd "$TOP_DIR"
+ cd "$TOP_DIR"
- git-reset --hard "$1" > /dev/null
- head -n "-$2" < "$applied" > "$applied.tmp"
- mv "$applied.tmp" "$applied"
+ git-reset --hard "$1" > /dev/null
+ head -n "-$2" < "$applied" > "$applied.tmp"
+ mv "$applied.tmp" "$applied"
)
# update references to top, bottom, and base
@@ -490,7 +477,7 @@ __refresh_patch()
(
cd "$TOP_DIR"
- p="$GUILT_DIR/$branch/$1"
+ p="$GUILT_DIR/$branch/$1"
git-diff-files --name-only | (while read n; do git-update-index "$n" ; done)
@@ -524,30 +511,25 @@ __refresh_patch()
# The output of this function is suitable to be passed to git-rev-list
munge_hash_range()
{
- [ -z "$1" ] && return 1
-
- local l=`echo "$1" | sed -e 's/\.\./ /'`
-
- local h1=`echo "$l" | cut -s -d' ' -f 1`
- local h2=`echo "$l" | cut -s -d' ' -f 2`
-
- if [ -z "$h1" -a -z "$h2" ]; then
- # e.g., "v0.19"
- echo "$l^..$l"
- elif [ -z "$h1" ]; then
- # e.g., "..v0.10"
- echo "$h2"
- elif [ -z "$h2" ]; then
- # e.g., "v0.19.."
- echo "$h1..HEAD"
- elif [ ! -z "$h1" -a ! -z "$h2" ]; then
- # e.g., "v0.19-rc1..v0.19"
- echo "$h1..$h2"
- else
- # unknown hash range format
- return 1
- fi
-
+ case "$1" in
+ *..*..*|*\ *)
+ # double .. or space is illegal
+ return 1;;
+ ..*)
+ # e.g., "..v0.10"
+ echo ${1#..};;
+ *..)
+ # e.g., "v0.19.."
+ echo ${1%..}..HEAD;;
+ *..*)
+ # e.g., "v0.19-rc1..v0.19"
+ echo ${1%%..*}..${1#*..};;
+ ?*)
+ # e.g., "v0.19"
+ echo $1^..$1;;
+ *) # empty
+ return 1;;
+ esac
return 0
}
--
1.5.2.1
^ permalink raw reply related
* [PATCH guilt] make guilt use standard POSIX shell
From: Pierre Habouzit @ 2007-06-14 12:50 UTC (permalink / raw)
To: Josef Jeff Sipek; +Cc: git
This patch series makes guilt be able to work with a standard posix shell.
This has been tested with bash, zsh, dash and posh acting as /bin/sh.
This uses awk and sed a bit more than before, but POSIX awk and sed should be
enough. Though GNU find and GNU /bin/echo from the coreutils needs to be
there.
Here is the shortlog:
Pierre Habouzit (7):
Regression test suite needs bash, that's OK.
guilt(1): Obvious bashisms fixed.
guilt(1): simplifications...
guilt(1): reimplement push_patch, using a subshell to avoid locals.
Easy commands, without bashisms.
guilt-status(1): Remove bashisms.
Remove last bashisms from remaining commands.
and the diffstat:
guilt | 448 +++++++++++++++++++------------------------
guilt-add | 7 +-
guilt-applied | 4 +-
guilt-delete | 4 +-
guilt-export | 6 +-
guilt-files | 6 +-
guilt-fold | 4 +-
guilt-fork | 6 +-
guilt-graph | 13 +-
guilt-header | 4 +-
guilt-help | 6 +-
guilt-import | 6 +-
guilt-import-commit | 6 +-
guilt-init | 4 +-
guilt-new | 15 +-
guilt-next | 6 +-
guilt-patchbomb | 10 +-
guilt-pop | 4 +-
guilt-prev | 4 +-
guilt-push | 16 +-
guilt-rebase | 4 +-
guilt-refresh | 4 +-
guilt-rm | 4 +-
guilt-series | 6 +-
guilt-status | 58 +++---
guilt-top | 4 +-
guilt-unapplied | 12 +-
regression/010-init.sh | 1 +
regression/011-no-repo.sh | 1 +
regression/020-push.sh | 1 +
regression/021-pop.sh | 1 +
regression/022-applied.sh | 1 +
regression/023-top.sh | 1 +
regression/024-unapplied.sh | 1 +
regression/025-new.sh | 1 +
regression/026-delete.sh | 1 +
regression/027-refresh.sh | 1 +
regression/050-series.sh | 1 +
regression/060-files.sh | 1 +
regression/Makefile | 2 +-
uninstall | 7 +-
41 files changed, 317 insertions(+), 375 deletions(-)
^ permalink raw reply
* Re: pull into dirty working tree
From: Bill Lear @ 2007-06-14 12:46 UTC (permalink / raw)
To: Linus Torvalds; +Cc: git
In-Reply-To: <alpine.LFD.0.98.0706132216300.14121@woody.linux-foundation.org>
On Wednesday, June 13, 2007 at 22:21:38 (-0700) Linus Torvalds writes:
>On Wed, 13 Jun 2007, Bill Lear wrote:
>>
>> We have some CVS users who complain that they cannot do a pull
>> into a dirty working tree, as they could under CVS.
>
>Well, a lot of people have told you that the answer is "don't do that",
>but I actually somewhat disagree.
I have now officially fallen out of my chair.
>I think it might be perfectly fine to allow for a *fast-forward* pull to
>do a three-way merge on the working tree, assuming the index is clean in
>the paths that got modified.
>...
>It might make it a bit easier for CVS people to get used to the git model:
>keep your dirty working tree, and do "git pull" to update it, and fix up
>any conflicts in the working tree. That's how CVS works - it's a bad
>model, but it's a model that may be worth supporting just to get people
>more easily into the _good_ model.
Exactly my desires. I think it could work reliably, and as they
mature into git users, they will come to appreciate branches.
Bill
^ permalink raw reply
* Re: [PATCH] Add a guilt-export(1) command to export a guilt series to quilt.
From: Pierre Habouzit @ 2007-06-14 10:38 UTC (permalink / raw)
To: Josef Sipek; +Cc: Benjamin Sergeant, git
In-Reply-To: <20070613155454.GC18989@filer.fsl.cs.sunysb.edu>
[-- Attachment #1: Type: text/plain, Size: 1147 bytes --]
On Wed, Jun 13, 2007 at 11:54:54AM -0400, Josef Sipek wrote:
> On Wed, Jun 13, 2007 at 08:10:36AM -0700, Benjamin Sergeant wrote:
> > For the shebang:
> > #!/usr/bin/env bash
> > should works well and should work on non-linux boxes that did not
> > added a link in /bin/bash.
>
> Ideally, the best thing to do is to change guilt to use /bin/sh. Right now,
> there are a number of bash-isms that are used. And if a system doesn't have
> /bin/sh, it doesn't deserve to run any useful software ;)
>
> Patches are welcomed ;)
Makes sense. I'm currently working on it (so that nobody loses time on
that issue).
I'm mostly done with guilt(1), I still need to take some "local"
variables down (especially in guilt_push or whatever the function name
is). Most of the rest has been dealt with already.
I should send a patch serie towards POSIX-shell-isation soon, as soon
as I've tested the patches with bash, zsh, dash and posh.
Cheers,
--
·O· Pierre Habouzit
··O madcoder@debian.org
OOO http://www.madism.org
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply
* Re: [PATCH] post-receive-email hook: handle order of arguments consistently
From: Andy Parkins @ 2007-06-14 10:19 UTC (permalink / raw)
To: git; +Cc: Gerrit Pape, Junio C Hamano, 428413
In-Reply-To: <20070614090929.31616.qmail@c76df6d65db410.315fe32.mid.smarden.org>
On Thursday 2007 June 14, Gerrit Pape wrote:
> The post-receive-email hook usually gets its arguments through stdin, but
> also supports them to be specified at the command line. The order of the
> arguments should consistently follow the documentation no matter how they
> are passed to the script.
That wasn't done casually. It was done so that the same script would work as
an update hook as well.
I have no objection to the change, as the update hook was not the right place
for generating emails. However, it let me use that same update hook on a
system that did not have a git with support for the post-receive hook.
Andy
--
Dr Andy Parkins, M Eng (hons), MIET
andyparkins@gmail.com
^ permalink raw reply
* Re: git log -p file.c
From: sf @ 2007-06-14 10:15 UTC (permalink / raw)
To: git
In-Reply-To: <20070614090217.GA8271@informatik.uni-freiburg.de>
Uwe Kleine-Koenig wrote:
> hello,
>
> when I run
>
> git log -p file.c
>
> I don't get the complete change a commit introduces but only how file.c
> changed. This is kind of surprising for me, I had expected to get the
> whole diff.
git log --full-diff -p file.c
(--full-diff seems to be undocumented)
Regards
Stephan
^ permalink raw reply
* Re: [PATCH] Introduce file with the common default build-time items.
From: Eygene Ryabinkin @ 2007-06-14 9:56 UTC (permalink / raw)
To: Shawn O. Pearce; +Cc: git
In-Reply-To: <20070614043633.GV6073@spearce.org>
Shawn, good day.
Thu, Jun 14, 2007 at 12:36:33AM -0400, Shawn O. Pearce wrote:
> Eygene Ryabinkin <rea-git@codelabs.ru> wrote:
> > Words 'wish' and 'tclsh' are scattered across at least three files,
> > but they are tied to the same entities. To ease the maintenance
> > and remove errors, these configuration items were gathered into the
> > separate file named 'common-make-vars.def'.
> ...
> > diff --git a/git-gui/Makefile b/git-gui/Makefile
> > index 3de0de1..654641a 100644
> > --- a/git-gui/Makefile
> > +++ b/git-gui/Makefile
> > @@ -6,6 +6,8 @@ all::
> > GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
> > @$(SHELL_PATH) ./GIT-VERSION-GEN
> > -include GIT-VERSION-FILE
> > +# Default values
> > +-include ../common-make-vars.def
>
> A good idea to try and make these all common, but you cannot do this,
> or at least this part of the patch.
>
> The git-gui subdirectory of git.git is actually its own project,
> maintained in its own Git repository.
OK, but then may be it will be logical to put Tcl/Tk-related variables
to the git-gui/common-make-vars.def? I am a little worried about
this, because gitk is the part of the git.git and it should get the
variables too. The drawback here is if you will update your git-gui
repo, then git.git will need to wait for your import to get the
changes in the variables. And this will seriously couple git.git
and git-gui, though I don't know if it is good or bad.
Any ideas?
--
Eygene
^ permalink raw reply
* [PATCH] post-receive-email hook: handle order of arguments consistently
From: Gerrit Pape @ 2007-06-14 9:09 UTC (permalink / raw)
To: Junio C Hamano, git; +Cc: 428413
The post-receive-email hook usually gets its arguments through stdin, but
also supports them to be specified at the command line. The order of the
arguments should consistently follow the documentation no matter how they
are passed to the script.
This was noticed and suggested by martin f krafft through
http://bugs.debian.org/428413
Signed-off-by: Gerrit Pape <pape@smarden.org>
---
contrib/hooks/post-receive-email | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/contrib/hooks/post-receive-email b/contrib/hooks/post-receive-email
index c589a39..f84532f 100644
--- a/contrib/hooks/post-receive-email
+++ b/contrib/hooks/post-receive-email
@@ -605,7 +605,7 @@ envelopesender=$(git-repo-config hooks.envelopesender)
if [ -n "$1" -a -n "$2" -a -n "$3" ]; then
# Output to the terminal in command line mode - if someone wanted to
# resend an email; they could redirect the output to sendmail themselves
- PAGER= generate_email $2 $3 $1
+ PAGER= generate_email $1 $2 $3
else
if [ -n "$envelopesender" ]; then
envelopesender="-f '$envelopesender'"
--
1.5.2.1
^ permalink raw reply related
* Re: [PATCH] Interpret :/<pattern> as a regular expression
From: Sam Vilain @ 2007-06-14 9:07 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.64.0706140909360.4059@racer.site>
Johannes Schindelin wrote:
>> A strange thing to conclude from your figures, which show pcre as the
>> fastest out of several libraries that you tested.
>>
>
> The best of the worse. Yes. An external (!) program was 4x faster than
> pcre. I don't know how to make it more obvious that pcre sucks.
>
Oh, your position is obvious enough, but it is correct and supportable
by the available evidence? Why not read past the first paragraph of my
post and reply to that.
Sam.
^ permalink raw reply
* git log -p file.c
From: Uwe Kleine-Koenig @ 2007-06-14 9:02 UTC (permalink / raw)
To: git
hello,
when I run
git log -p file.c
I don't get the complete change a commit introduces but only how file.c
changed. This is kind of surprising for me, I had expected to get the
whole diff.
Reading git-log(1), -p should "Show the change the commit introduces in
a patch form." It's not 100% clear, but as I understand it, this means
the whole patch should be shown?
And is it intended that (clean) merges are shown?
Best regards
Uwe
PS: I currently have only very limited access to the internet, so the
version used is 1.5.2.1.133.gd44c7. Sorry if that issue is already
resolved :-)
--
Uwe Kleine-Koenig
http://www.google.com/search?q=gigabyte+in+bit
^ permalink raw reply
* Re: Stupid quoting...
From: Alex Riesen @ 2007-06-14 8:51 UTC (permalink / raw)
To: David Kastrup; +Cc: git
In-Reply-To: <86hcpb6lr6.fsf@lola.quinscape.zz>
On 6/14/07, David Kastrup <dak@gnu.org> wrote:
> "Alex Riesen" <raa.lkml@gmail.com> writes:
>
> > On 6/14/07, David Kastrup <dak@gnu.org> wrote:
> >> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >> >> Can you actually name a program that would work with the default
> >> >> output of git here?
> >> >
> >> > echo.
> >>
> >> It doesn't, since it does not interpret the \NNN escape sequences that
> >> git chooses to output.
> >
> > Have you tried that -z switch yet?
>
> What has that to do with "the default output of git"?
>
> Yes, in my application I _will_ be using -z
Just checking.
> (in connection with the rather hackish read -d '' name
> command from bash which is not really documented) but that does not
> change the fact that the default output is broken. There is no reason
> whatsoever to use octal quotes for non-ASCII characters. Neither
> programs nor humans are better off by that, and none of the derision
> bestowed upon me changes that.
Well, fix that. How do you think _should_ it be?
It's just up until now you are only complaining.
No _useful_ idea came from you.
^ permalink raw reply
* Re: Stupid quoting...
From: Junio C Hamano @ 2007-06-14 8:49 UTC (permalink / raw)
To: Johannes Schindelin; +Cc: David Kastrup, git
In-Reply-To: <Pine.LNX.4.64.0706131316390.4059@racer.site>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> On Wed, 13 Jun 2007, David Kastrup wrote:
>
>> what is the point in quoting file names and their characters in
>> git-diff's output? And what is the recommended way of undoing the
>> damage?
>
> The recommended way is not using spaces to begin with. I mean, does
> "David" contain spaces? People seem not to see the problem, and fail to
> blame Microsoft for all the damage they have done, introducing that
> stupid, stupid concept of filenames containing spaces, and _enforcing_ it.
Why are you talking about spaces ;-)?
There are a few things to note, but the first thing is that mere
spaces do not trigger quoting. A tab (HT) does, so do non ASCII
characters. The second thing is that we do this quoting for
various good reasons, and it is not likely to change.
As Alex mentions, the most safe way for programs to read is to
read from the -z format. However, even if you are capable to do
so, it may be inconvenient in some languages (mainstream
languages like C and Perl are not among them). Not quoting SP
is a conscious decision, as SP in filenames are rather common,
more common than non ASCII and much more common than HT.
The "raw" formats "ls-files -s", "ls-tree" and "diff --raw"
produce are designed to put names at the end, and typically
delimited with a HT, so that "lazy" scripts can use cut (whose
default delimiter is a HT) to pick out pieces from its output.
And plumbing tools reading from the standard input (most
notably, "update-index --stdin") know how to unquote them. In
practice, not many people use non ASCII in pathnames and expect
them work sanely for everybody, so loosely written scripts, as
long as they cut at HT to pick out the pathname part, "mostly"
work (I think traditional core git scripts are safe, I suspect
some contributed ones shipped with git core may not be, Cogito
used to be very unsafe but it was audited and became much safer
before it got discontinued).
The pathname quoting rules in textual output was chosen
primarily to make diff output safer, as one of the most
important workflow git supports is e-mailable patches.
GNU patch treats HT on "+++ name"/"--- name" lines as the end of
name (and after HT comes timestamp), but the timestamp part is
treated as optional, which introduces ambiguities and confusion.
The issue was discussed some time ago (check the list archive
for discussion among I, Linus and Paul Eggert -- the GNU diff
and patch maintainer) and the quoting rules we use now is
consistent with what the diff and patch plan to use. The update
on the GNU side may have already happened, it may not have.
When a patch appears in an e-mail, you would need to be aware
that not everybody has the luxury of living in UTF-8 only world.
Your commit message and cover letter may be in one encoding, the
pathnames that appear in diff headers may be in your filesystem
encoding, and the patch text that appear as the diff payload may
be in another document specific encoding. All three could be
different (worse, a patch that touch more than one file can
carry different encodings in the payload part), and mixing
character set in a single piece of e-mail confuses people's MUA
and tends to mangle messages. Quoting non ASCII characters in
pathnames, even they are perfectly valid and ordinary UTF-8
strings, is to eliminate one element in the above three as a
possible source of worries.
^ permalink raw reply
* Re: [PATCH] Interpret :/<pattern> as a regular expression
From: Johannes Schindelin @ 2007-06-14 8:09 UTC (permalink / raw)
To: Sam Vilain; +Cc: Jeff King, git
In-Reply-To: <4670F2BB.5060909@vilain.net>
Hi,
On Thu, 14 Jun 2007, Sam Vilain wrote:
> Johannes Schindelin wrote:
>
> > So no, I think pcre is just not worth it.
>
> A strange thing to conclude from your figures, which show pcre as the
> fastest out of several libraries that you tested.
The best of the worse. Yes. An external (!) program was 4x faster than
pcre. I don't know how to make it more obvious that pcre sucks.
Hth,
Dscho
^ permalink raw reply
* Re: pull into dirty working tree
From: Steven Grimm @ 2007-06-14 8:06 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, Bill Lear, git
In-Reply-To: <7vps3zascu.fsf@assigned-by-dhcp.pobox.com>
Junio C Hamano wrote:
> If a bad model _is_ supported, what incentive is there for these
> people to move into the good model, I honestly wonder..
Presumably it's a good model because it's easier, more productive, more
predictable, more reliable, or some combination of those things; that's
the incentive. If it's none of those things for a given developer, then
maybe it's not in fact a better model for them.
Of course, even if it is better for them, some people will never move --
but those are the people who won't willingly move to git anyway unless
the bad model is supported. There are enough of them out there that
people who *do* want to use the good model, but have to work in an
environment where they're outnumbered by those other folks, find they
can't sell the organization on git because it forces a change in work
style on people who aren't interested in changing their work styles.
(Not a purely hypothetical statement, sadly.)
You can view this in terms of being a leg up for people who *do* want to
use git, but are in environments where they are unable to convince or
force everyone else to adopt git-style workflows. I think it's telling
that almost all the discussions about this kind of feature are of the
form, "I'm trying to convince my team to use git, and they find it no
good because of X." It's the person trying to sell git to the group,
presumably so they can use it themselves without having to go through a
CVS or Subversion or p4 gateway, that this stuff really helps. That the
rest of the team will benefit down the road too is nice but probably not
the immediate selfish personal goal of the people who are asking for
this kind of feature.
-Steve
^ permalink raw reply
* Re: pull into dirty working tree
From: Raimund Bauer @ 2007-06-14 8:01 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Linus Torvalds, Bill Lear, git
In-Reply-To: <7vps3zascu.fsf@assigned-by-dhcp.pobox.com>
On Thu, 2007-06-14 at 00:49 -0700, Junio C Hamano wrote:
> Linus Torvalds <torvalds@linux-foundation.org> writes:
>
> > It might make it a bit easier for CVS people to get used to the git model:
> > keep your dirty working tree, and do "git pull" to update it, and fix up
> > any conflicts in the working tree. That's how CVS works - it's a bad
> > model, but it's a model that may be worth supporting just to get people
> > more easily into the _good_ model.
>
> If a bad model _is_ supported, what incentive is there for these
> people to move into the good model, I honestly wonder...
Is it a bad model for the normal development process? Probably.
Would it solve the problem of "I want to keep my debug-statements that I
won't ever commit in the merged result"? ... yes
I think that's at least one valid usecase we should probably support.
One I'd also like to use ;-)
--
best regards
Ray
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox