diff --git a/guilt b/guilt index 3b66174..eaec27c 100755 --- a/guilt +++ b/guilt @@ -1,6 +1,6 @@ #!/bin/sh # -# Copyright (c) Josef "Jeff" Sipek, 2006, 2007 +# Copyright (c) Josef "Jeff" Sipek, 2006-2008 # GUILT_VERSION="0.28" @@ -30,7 +30,7 @@ SUBDIRECTORY_OK=1 # gitver=`git --version | cut -d' ' -f3` case "$gitver" in - 1.5.*) ;; # git-config + 1.5.*) ;; # git config *) die "Unsupported version of git ($gitver)" ;; esac @@ -135,7 +135,7 @@ valid_patchname() get_branch() { - git-symbolic-ref HEAD | sed -e 's,^refs/heads/,,' + git symbolic-ref HEAD | sed -e 's,^refs/heads/,,' } verify_branch() @@ -185,13 +185,13 @@ get_series() do_make_header() { # we should try to work with commit objects only - if [ `git-cat-file -t "$1"` != "commit" ]; then + if [ `git cat-file -t "$1"` != "commit" ]; then echo "Hash $1 is not a commit object" >&2 echo "Aborting..." >&2 exit 2 fi - git-cat-file -p "$1" | awk ' + git cat-file -p "$1" | awk ' BEGIN{headers=1; firstline=1} /^author / && headers { sub(/^author +/, ""); @@ -329,7 +329,7 @@ pop_many_patches() ( cd "$TOP_DIR" - git-reset --hard "$1" > /dev/null + git reset --hard "$1" > /dev/null head -n "-$2" < "$applied" > "$applied.tmp" mv "$applied.tmp" "$applied" ) @@ -359,9 +359,9 @@ update_stack_tags() # bottom and base hashes, and update the tags mkdir -p `dirname "$GIT_DIR/refs/tags/${branch}_top"` - git-rev-parse HEAD > "$GIT_DIR/refs/tags/${branch}_top" + 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" + 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 @@ -390,11 +390,11 @@ push_patch() cd "$TOP_DIR" # apply the patch if and only if there is something to apply - if [ `git-apply --numstat "$p" | wc -l` -gt 0 ]; then + if [ `git apply --numstat "$p" | wc -l` -gt 0 ]; then if [ "$bail_action" = abort ]; then reject="" fi - git-apply -C$guilt_push_diff_context --index \ + git apply -C$guilt_push_diff_context --index \ $reject "$p" > /dev/null 2> "$TMP_LOG" __push_patch_bail=$? @@ -431,9 +431,9 @@ s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\( export GIT_COMMITTER_DATE="$GIT_AUTHOR_DATE" # commit - treeish=`git-write-tree` - commitish=`git-commit-tree $treeish -p HEAD < "$TMP_MSG"` - echo $commitish > $GIT_DIR/`git-symbolic-ref HEAD` + treeish=`git write-tree` + commitish=`git commit-tree $treeish -p HEAD < "$TMP_MSG"` + echo $commitish > $GIT_DIR/`git symbolic-ref HEAD` # mark patch as applied echo "$commitish:$pname" >> $applied @@ -453,7 +453,7 @@ s/^\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\) \([0-9]\{2\}\):\([0-9]\{2\}\):\( # usage: must_commit_first must_commit_first() { - [ `git-diff-files | wc -l` -eq 0 ] + [ `git diff-files | wc -l` -eq 0 ] return $? } @@ -489,7 +489,7 @@ __refresh_patch() cd "$TOP_DIR" p="$GUILT_DIR/$branch/$1" - git-diff-files --name-only | (while read n; do git-update-index "$n" ; done) + git diff-files --name-only | (while read n; do git update-index "$n" ; done) # get the patch header do_get_full_header "$p" > "$TMP_DIFF" @@ -499,13 +499,13 @@ __refresh_patch() if [ ! -z "$5" ]; then ( echo "---" - git-diff --stat $diffopts "$2" + git diff --stat $diffopts "$2" echo "" ) >> "$TMP_DIFF" fi # get the new patch - git-diff $diffopts "$2" >> "$TMP_DIFF" + git diff $diffopts "$2" >> "$TMP_DIFF" # move the new patch in mv "$p" "$p~" @@ -528,7 +528,7 @@ __refresh_patch() # .. - until hash (includes hash) # .. - from hash to hash (inclusive) # -# The output of this function is suitable to be passed to git-rev-list +# The output of this function is suitable to be passed to "git rev-list" munge_hash_range() { case "$1" in @@ -579,7 +579,7 @@ guilt_hook() # Some constants # -# used for: git-apply -C +# used for: git apply -C guilt_push_diff_context=1 # @@ -587,14 +587,14 @@ guilt_push_diff_context=1 # # autotag? -autotag=`git-config guilt.autotag` +autotag=`git config guilt.autotag` [ -z "$autotag" ] && autotag=1 # # The following gets run every time this file is source'd # -TOP_DIR=`git-rev-parse --show-cdup` +TOP_DIR=`git rev-parse --show-cdup` if [ -z "$TOP_DIR" ]; then TOP_DIR="./" fi diff --git a/guilt-add b/guilt-add index ebf41e4..0159180 100755 --- a/guilt-add +++ b/guilt-add @@ -10,4 +10,4 @@ if [ $# -lt 1 ]; then usage fi -exec git-add -- "$@" +exec git add -- "$@" diff --git a/guilt-branch b/guilt-branch index 8bacfc3..8876d44 100755 --- a/guilt-branch +++ b/guilt-branch @@ -25,8 +25,8 @@ if [ -e "$GUILT_DIR/$newbranch" ]; then die "Patch directory for branch \"$newbranch\" already exists." fi -git-branch "$newbranch" -git-checkout "$newbranch" +git branch "$newbranch" +git checkout "$newbranch" mkdir -p "$GUILT_DIR/`dirname $newbranch`" diff --git a/guilt-diff b/guilt-diff index 85e5fcb..d740c70 100755 --- a/guilt-diff +++ b/guilt-diff @@ -17,7 +17,7 @@ while [ $# -ne 0 ]; do done if [ ! -z "$working_tree" ] ; then - git-diff + git diff else - git-diff HEAD^ + git diff HEAD^ fi diff --git a/guilt-files b/guilt-files index 3428be4..d9b3508 100755 --- a/guilt-files +++ b/guilt-files @@ -40,7 +40,7 @@ fi | while read obj patch; do fi IFS=' ' - git-diff-tree -r $obj^ $obj | tr '\t' ' '| + git diff-tree -r $obj^ $obj | tr '\t' ' '| while read omode nmode osha1 nsha1 st file; do if [ -n "$opt_labels" ]; then if [ -n "$opt_verbose" ]; then diff --git a/guilt-graph b/guilt-graph index 094cad0..b749a90 100755 --- a/guilt-graph +++ b/guilt-graph @@ -13,10 +13,10 @@ fi patchname="$1" bottom=`head -1 < "$applied" | cut -d: -f1` -base=`git-rev-parse $bottom^` +base=`git rev-parse $bottom^` if [ -z "$patchname" ]; then - top=`git-rev-parse HEAD` + top=`git rev-parse HEAD` else top=`grep "^[0-9a-f]\{40\}:$patchname" "$applied" | cut -d: -f1` if [ -z "$top" ]; then @@ -26,7 +26,7 @@ fi getfiles() { - git-diff-tree -r "$1^" "$1" | tr '\t' ' ' | cut -d' ' -f6 + git diff-tree -r "$1^" "$1" | tr '\t' ' ' | cut -d' ' -f6 } cache="$GUILT_DIR/$branch/.graphcache.$$" @@ -58,7 +58,7 @@ while [ "$current" != "$base" ]; do echo " \"${h:0:8}\" -> \"${current:0:8}\"; // ?" done - current=`git-rev-parse $current^` + current=`git rev-parse $current^` done echo "}" diff --git a/guilt-import-commit b/guilt-import-commit index 28846e1..cd4a456 100755 --- a/guilt-import-commit +++ b/guilt-import-commit @@ -20,8 +20,8 @@ fi echo "About to begin conversion..." >&2 echo "Current head: `cat $GIT_DIR/refs/heads/$branch`" >&2 -for rev in `git-rev-list $rhash`; do - s=`git-log --pretty=oneline -1 $rev | cut -c 42-` +for rev in `git rev-list $rhash`; do + s=`git log --pretty=oneline -1 $rev | cut -c 42-` fname=`echo $s | sed -e "s/&/and/g" -e "s/[ :]/_/g" -e "s,[/\\],-,g" \ -e "s/['\\[{}]//g" -e 's/]//g' | tr A-Z a-z` @@ -39,7 +39,7 @@ for rev in `git-rev-list $rhash`; do ( do_make_header $rev echo "" - git-diff $rev^..$rev + git diff $rev^..$rev ) > $GUILT_DIR/$branch/$fname # FIXME: grab the GIT_AUTHOR_DATE from the commit object and set the @@ -50,9 +50,10 @@ for rev in `git-rev-list $rhash`; do # Only reset if the commit was on this branch if head_check $rev 2> /dev/null; then - # BEWARE: git-reset ahead! Is there a way to verify that we really - # created a patch? - We don't want to lose any history. - git-reset --hard $rev^ > /dev/null + # BEWARE: "git reset" ahead! Is there a way to verify that + # we really created a patch? - We don't want to lose any + # history. + git reset --hard $rev^ > /dev/null elif [ -z "$warned" ]; then echo "Warning: commit $rev is not the HEAD...preserving commit" >&2 echo "Warning: (this message is displayed only once)" >&2 diff --git a/guilt-init b/guilt-init index 003903b..e895ab4 100755 --- a/guilt-init +++ b/guilt-init @@ -36,4 +36,4 @@ cat > "$GIT_DIR/hooks/guilt/delete" <.*/>/'`\n\n" +[ "$signoff" = "t" ] && printf "Signed-off-by: `git var GIT_COMMITTER_IDENT | sed -e 's/>.*/>/'`\n\n" ) >> "$GUILT_DIR/$branch/$patch" # edit -e ? @@ -82,8 +82,8 @@ mkdir_dir=`dirname "$GUILT_DIR/$branch/$patch"` if [ ! -z "$force" ]; then ( cd "$TOP_DIR" - git-diff HEAD >> "$GUILT_DIR/$branch/$patch" - git-reset --hard HEAD > /dev/null + git diff HEAD >> "$GUILT_DIR/$branch/$patch" + git reset --hard HEAD > /dev/null ) fi diff --git a/guilt-patchbomb b/guilt-patchbomb index a43151a..2ac3b2a 100755 --- a/guilt-patchbomb +++ b/guilt-patchbomb @@ -32,7 +32,7 @@ if [ $? -ne 0 ]; then fi # display the list of commits to be sent as patches -git-log --pretty=oneline "$r" | cut -c 1-8,41- | $pager +git log --pretty=oneline "$r" | cut -c 1-8,41- | $pager echo -n "Are these what you want to send? [Y/n] " read n @@ -46,7 +46,7 @@ if [ -e $dir ]; then fi echo "Using '$dir' as temporary directory" -git-format-patch -o $dir -n -s "$r" +git format-patch -o $dir -n -s "$r" # get the to/cc addresses echo -n "Enter all the To: email addresses (separated by space): " @@ -66,7 +66,7 @@ done opts="" # more than 1 commit -if [ `git-rev-list "$r" | wc -l` -gt 1 ]; then +if [ `git rev-list "$r" | wc -l` -gt 1 ]; then opts="$opts --no-chain-reply-to --compose" fi opts="$opts $to_opts" @@ -79,10 +79,10 @@ if [ "$n" != "y" ] && [ "$n" != "Y" ]; then fi # ...and off they go. -cmd="git-send-email" +cmd="git send-email" if [ ! -z "$do_not_send" ]; then echo "-n passed: not sending, command that would be executed:" >&2 - cmd="echo git-send-email" + cmd="echo git send-email" fi if [ -z "$reply_to" ]; then diff --git a/guilt-pop b/guilt-pop index 46a34f4..2973af1 100755 --- a/guilt-pop +++ b/guilt-pop @@ -85,7 +85,7 @@ fi # if we are forcing the pop, reset first if [ ! -z "$force" ]; then cd "$TOP_DIR" >&2 >/dev/null - git-reset --hard + git reset --hard cd - >&2 >/dev/null elif ! must_commit_first; then die "Uncommited changes detected. Refresh first." diff --git a/guilt-rebase b/guilt-rebase index a03e66d..3a698e1 100755 --- a/guilt-rebase +++ b/guilt-rebase @@ -19,8 +19,8 @@ fi case "$#" in 1) - upstream=`git-rev-parse --verify "$1"` && - ours=`git-rev-parse --verify HEAD` || usage + upstream=`git rev-parse --verify "$1"` && + ours=`git rev-parse --verify HEAD` || usage limit="$upstream" ;; *) @@ -37,8 +37,8 @@ fi # Note that these list commits in reverse order; # not that the order in inup matters... -inup=`git-rev-list ^$ours $upstream` && -ours=`git-rev-list $ours ^$limit` || exit +inup=`git rev-list ^$ours $upstream` && +ours=`git rev-list $ours ^$limit` || exit rebase_dir="$GUILT_DIR/$branch/.rebase.$$" mkdir "$rebase_dir" @@ -47,8 +47,8 @@ mkdir "$rebase_dir" # calculate the patch ids for all the commits in upstream # for c in $inup ; do - git-diff-tree -p $c -done | git-patch-id | while read id name ; do + git diff-tree -p $c +done | git patch-id | while read id name ; do echo "$name" >> "$rebase_dir/$id" done @@ -58,10 +58,10 @@ cp "$applied" "$rebase_dir/status" echo "First, poping all patches..." pop_all_patches -git-merge --no-commit $upstream > /dev/null 2> /dev/null +git merge --no-commit $upstream > /dev/null 2> /dev/null echo "" -log=`git-log -1 --pretty=oneline` +log=`git log -1 --pretty=oneline` echo "HEAD is now at `echo $log | cut -c 1-7`... `echo "$log" | cut -c 41-`" # @@ -76,7 +76,7 @@ IFS=":" cat "$rebase_dir/status" | while read hash name; do echo "" IFS=" " - cat "$GUILT_DIR/$branch/$name" | git-patch-id | + cat "$GUILT_DIR/$branch/$name" | git patch-id | while read patchid commitid ; do echo "Applying '$name'" if [ -f "$rebase_dir/$patchid" ]; then diff --git a/guilt-repair b/guilt-repair index 6493a42..62a0991 100755 --- a/guilt-repair +++ b/guilt-repair @@ -28,7 +28,7 @@ echo "Current HEAD commit $oldrev" if [ -s "$applied" ]; then # there were some patches applied - newrev=`git-rev-parse $(head -1 < "$applied" | cut -d: -f1)^` + newrev=`git rev-parse $(head -1 < "$applied" | cut -d: -f1)^` else # no patches were applied, but let's do all the work anyway newrev="$oldrev" @@ -43,7 +43,7 @@ if [ "$n" != "y" ] && [ "$n" != "Y" ]; then fi # blow away any commits -git-reset --hard "$newrev" > /dev/null +git reset --hard "$newrev" > /dev/null # blow away the applied stack printf "" > "$applied" diff --git a/guilt-rm b/guilt-rm index 0ec120d..77e8553 100755 --- a/guilt-rm +++ b/guilt-rm @@ -10,5 +10,5 @@ if [ $# -lt 1 ]; then usage fi -git-rm -- "$@" +git rm -- "$@" diff --git a/guilt-series b/guilt-series index 9c34a08..89a8eb4 100755 --- a/guilt-series +++ b/guilt-series @@ -30,7 +30,7 @@ elif [ ! -z "$gui" ]; then range="$bottom..$top" # FIXME, this doesn't quite work - it's perfectly fine with - # git-rev-list, but gitk for whatever reason likes to include the + # "git rev-list", but gitk for whatever reason likes to include the # parent [ "$bottom" = "$top" ] && range="$bottom^..$bottom" diff --git a/guilt-status b/guilt-status index bc2f33e..a34e98e 100755 --- a/guilt-status +++ b/guilt-status @@ -51,7 +51,7 @@ if [ -z "$DIFF_FILTER" ]; then DIFF_FILTER="ACDMRT" fi -git-rev-parse --verify HEAD >/dev/null 2>&1 || IS_INITIAL=t +git rev-parse --verify HEAD >/dev/null 2>&1 || IS_INITIAL=t print_status() { @@ -86,11 +86,11 @@ print_status() # 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 \ + 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 + 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/" @@ -100,10 +100,10 @@ print_status() # added if [ -z "$IS_INITIAL" ]; then # non-initial commit - git-diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD + git diff-index -M --name-status --diff-filter=$DIFF_FILTER HEAD else # initial commit - git-ls-files | sed -e "s/^/A\t/" + git ls-files | sed -e "s/^/A\t/" fi | sed -e ' s/\\/\\\\/g s/ /\\ /g