Git development
 help / color / mirror / Atom feed
* [PATCH] cg-* manpages: Handle more than one `cg-cmd` per line
From: Jonas Fonseca @ 2006-02-22  0:48 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

... which is the case for cg-update.

Signed-off-by: Jonas Fonseca <fonseca@diku.dk>

---
author Jonas Fonseca <fonseca@diku.dk> Wed, 22 Feb 2006 01:45:18 +0100

 Documentation/make-cg-asciidoc |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/make-cg-asciidoc b/Documentation/make-cg-asciidoc
index bc31809..126d4eb 100755
--- a/Documentation/make-cg-asciidoc
+++ b/Documentation/make-cg-asciidoc
@@ -42,7 +42,7 @@ CAPTION=$(echo "$HEADER" | head -n 1 | t
 # were referenced as "`cg-command`". This way references from cg-* combos in
 # code listings will be ignored.
 BODY=$(echo "$HEADER" | sed '0,/^$/d' \
-		      | sed 's/`\(cg-[a-z-]\+\)`/gitlink:\1[1]/;s/^\(-.*\)::.*/\1::/')
+		      | sed 's/`\(cg-[a-z-]\+\)`/gitlink:\1[1]/g;s/^\(-.*\)::.*/\1::/')
 
 DESCRIPTION=
 OPTIONS=

-- 
Jonas Fonseca

^ permalink raw reply related

* Re: How to not download objects more than needed?
From: Linus Torvalds @ 2006-02-22  0:42 UTC (permalink / raw)
  To: sean; +Cc: Radoslaw Szkodzinski, git
In-Reply-To: <BAYC1-PASMTP03A58A4F389365AC85DA68AEFC0@CEZ.ICE>



On Tue, 21 Feb 2006, sean wrote:
> 
> > I have linux-2.6 repository pulled and I'd like to download some branch
> > (say, netdev-2.6), which uses many of the same objects,
> > but not to get all the objects from the git server.
> 
> Just make sure you're not using the rsync protocol.   Using the
> native git protocol would be best.

Side note: the "automatic tag following" is broken wrt pulling unnecessary 
objects, even with the git protocol.

What happens is that if you don't explicitly have a branch for what you 
are pulling, and you do something like

	git pull git://git.kernel.org/....

and the automatic tag following kicks in, it will first have fetched the 
objects once, and then when it tries to fetch the tag objects, it will 
fetch the objects it already fetched _again_ (plus the tags), because it 
will do the same object pull, but the temporary branch (to be merged) will 
never have been written as a branch head.

So you'll see something like

	Generating pack...
	Done counting <x> objects.
	Packing <x> objects.......................
	Unpacking <x> objects
	 100% (<x>/<x>) done
	Auto-following refs/tags/v1.2.2
	Generating pack...
	Done counting <x+1> objects.
	Packing <x+1> objects.......................
	Unpacking <x+1> objects
	 100% (<x+1>/<x+1>) done
	* refs/tags/v1.2.2: storing tag 'v1.2.2' of master.kernel.org:/pub/scm/git/git

just because we hadn't updated any refs before we started re-fetching more 
objects.

So we do have cases where we fetch unnecessarily even with the native 
protocol.

		Linus

^ permalink raw reply

* [PATCH] git-add: Add support for --, documentation, and test.
From: Carl Worth @ 2006-02-21 23:33 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

This adds support to git-add to allow the common -- to separate
command-line options and file names. It adds documentation and a new
git-add test case as well.

---

 [In my tree on the git-add-dash-dash branch.]

 Documentation/git-add.txt |    7 ++++++-
 git-add.sh                |    4 ++++
 t/t3700-add.sh            |   22 ++++++++++++++++++++++
 3 files changed, 32 insertions(+), 1 deletions(-)
 create mode 100755 t/t3700-add.sh

af9363cd7aec2b39ad7ba4594e2c4d4757e8f644
diff --git a/Documentation/git-add.txt b/Documentation/git-add.txt
index 89e4614..7e29383 100644
--- a/Documentation/git-add.txt
+++ b/Documentation/git-add.txt
@@ -7,7 +7,7 @@ git-add - Add files to the index file.
 
 SYNOPSIS
 --------
-'git-add' [-n] [-v] <file>...
+'git-add' [-n] [-v] [--] <file>...
 
 DESCRIPTION
 -----------
@@ -26,6 +26,11 @@ OPTIONS
 -v::
         Be verbose.
 
+--::
+	This option can be used to separate command-line options from
+	the list of files, (useful when filenames might be mistaken
+	for command-line options).
+
 
 DISCUSSION
 ----------
diff --git a/git-add.sh b/git-add.sh
index 13fad82..d6a4bc7 100755
--- a/git-add.sh
+++ b/git-add.sh
@@ -14,6 +14,10 @@ while : ; do
     -v)
 	verbose=--verbose
 	;;
+    --)
+	shift
+	break
+	;;
     -*)
 	usage
 	;;
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
new file mode 100755
index 0000000..7c61034
--- /dev/null
+++ b/t/t3700-add.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Carl D. Worth
+#
+
+test_description='Test of git-add, including the -- option.'
+
+. ./test-lib.sh
+
+test_expect_success \
+    'Test of git-add' \
+    'touch foo && git-add foo'
+
+test_expect_success \
+    'Post-check that foo is in the index' \
+    'git-ls-files --error-unmatch foo'
+
+test_expect_success \
+    'Test that "git-add -- -q" works' \
+    'touch -- -q && git-add -- -q'
+
+test_done
-- 
1.2.2.g0a5f5-dirty


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: [PATCH] Add new git-rm command with documentation
From: Carl Worth @ 2006-02-21 23:04 UTC (permalink / raw)
  To: Krzysiek Pawlik; +Cc: Junio C Hamano, git
In-Reply-To: <87slqcs4y5.wl%cworth@cworth.org>

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

This adds a git-rm command which provides convenience similar to
git-add, (and a bit more since it takes care of the rm as well if
given -f).

Like git-add, git-rm expands the given path names through
git-ls-files. This means it only acts on files listed in the
index. And it does act recursively on directories by default, (no -r
needed as in the case of rm itself). When it recurses, it does not
remove empty directories that are left behind.

---

 On Tue, 21 Feb 2006 14:49:22 -0800, Carl Worth wrote:
 > If the -f option is desired we could get the correct behavior by using
 > update-index --force-remove when not given -f and update-index
 > --remove when given -f.

 One good argument for having the -f behavior is that this way
 "git rm file" makes a good complement for "git add file". I know that
 someone (recently?) asked on the list for an "unadd" operation. This
 would definitely be a lot more convenient than "git update-index
 --force-remove file".

 > That's enough complexity to warrant a test case. I'll be back shortly
 > with that...

 Here it is. This is a complete patch from master, rather than
 the incremental version that's in my tree.

 .gitignore               |    1
 Documentation/git-rm.txt |   89
 +++++++++++++++++++++++++++++++++++++++++++++++
 Makefile                 |    2 -
 git-rm.sh                |   67 +++++++++++++++++++++++++++++++++++
 t/t3600-rm.sh            |   42 ++++++++++++++++++++++
 5 files changed, 200 insertions(+), 1 deletion(-)

diff --git a/.gitignore b/.gitignore
index d7e8d2a..94f66d5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,6 +84,7 @@ git-resolve
 git-rev-list
 git-rev-parse
 git-revert
+git-rm
 git-send-email
 git-send-pack
 git-sh-setup
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
new file mode 100644
index 0000000..401bfb2
--- /dev/null
+++ b/Documentation/git-rm.txt
@@ -0,0 +1,89 @@
+git-rm(1)
+=========
+
+NAME
+----
+git-rm - Remove files from the working tree and from the index.
+
+SYNOPSIS
+--------
+'git-rm' [-f] [-n] [-v] [--] <file>...
+
+DESCRIPTION
+-----------
+A convenience wrapper for git-update-index --remove. For those coming
+from cvs, git-rm provides an operation similar to "cvs rm" or "cvs
+remove".
+
+
+OPTIONS
+-------
+<file>...::
+	Files to remove from the index and optionally, from the
+	working tree as well.
+
+-f::
+	Remove files from the working tree as well as from the index.
+
+-n::
+        Don't actually remove the file(s), just show if they exist in
+        the index.
+
+-v::
+        Be verbose.
+
+--::
+	This option can be used to separate command-line options from
+	the list of files, (useful when filenames might be mistaken
+	for command-line options).
+
+
+DISCUSSION
+----------
+
+The list of <file> given to the command is fed to `git-ls-files`
+command to list files that are registered in the index and
+are not ignored/excluded by `$GIT_DIR/info/exclude` file or
+`.gitignore` file in each directory.  This means two things:
+
+. You can put the name of a directory on the command line, and the
+  command will remove all files in it and its subdirectories (the
+  directories themselves are never removed from the working tree);
+
+. Giving the name of a file that is not in the index does not
+  remove that file.
+
+
+EXAMPLES
+--------
+git-rm Documentation/\\*.txt::
+
+	Removes all `\*.txt` files from the index that are under the
+	`Documentation` directory and any of its subdirectories. The
+	files are not removed from the working tree.
++
+Note that the asterisk `\*` is quoted from the shell in this
+example; this lets the command include the files from
+subdirectories of `Documentation/` directory.
+
+git-rm -f git-*.sh::
+
+	Remove all git-*.sh scripts that are in the index. The files
+	are removed from the index, and (because of the -f option),
+	from the working tree as well. Because this example lets the
+	shell expand the asterisk (i.e. you are listing the files
+	explicitly), it does not remove `subdir/git-foo.sh`.
+
+
+Author
+------
+Written by Linus Torvalds <torvalds@osdl.org>
+
+Documentation
+--------------
+Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff --git a/Makefile b/Makefile
index 317be3c..e98b056 100644
--- a/Makefile
+++ b/Makefile
@@ -109,7 +109,7 @@ SCRIPT_SH = \
 	git-merge-one-file.sh git-parse-remote.sh \
 	git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
 	git-repack.sh git-request-pull.sh git-reset.sh \
-	git-resolve.sh git-revert.sh git-sh-setup.sh \
+	git-resolve.sh git-revert.sh git-rm.sh git-sh-setup.sh \
 	git-tag.sh git-verify-tag.sh git-whatchanged.sh \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
diff --git a/git-rm.sh b/git-rm.sh
new file mode 100644
index 0000000..0a3f546
--- /dev/null
+++ b/git-rm.sh
@@ -0,0 +1,67 @@
+#!/bin/sh
+
+USAGE='[-f] [-n] [-v] [--] <file>...'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
+index_remove_option=--force-remove
+remove_files=
+show_only=
+verbose=
+while : ; do
+  case "$1" in
+    -f)
+	remove_files=true
+	index_remote_option=--force
+	;;
+    -n)
+	show_only=true
+	;;
+    -v)
+	verbose=--verbose
+	;;
+    --)
+	shift; break
+	;;
+    -*)
+	usage
+	;;
+    *)
+	break
+	;;
+  esac
+  shift
+done
+
+# This is typo-proofing. If some paths match and some do not, we want
+# to do nothing.
+case "$#" in
+0)	;;
+*)
+	git-ls-files --error-unmatch -- "$@" >/dev/null || {
+		echo >&2 "Maybe you misspelled it?"
+		exit 1
+	}
+	;;
+esac
+
+files=$(
+    if test -f "$GIT_DIR/info/exclude" ; then
+	git-ls-files \
+	    --exclude-from="$GIT_DIR/info/exclude" \
+	    --exclude-per-directory=.gitignore -- "$@"
+    else
+	git-ls-files \
+	--exclude-per-directory=.gitignore -- "$@"
+    fi | sort | uniq
+)
+
+case "$show_only" in
+true)
+	echo $files
+	;;
+*)
+	[[ "$remove_files" = "true" ]] && rm -- $files
+	git-update-index $index_remove_option $verbose $files
+	;;
+esac
diff --git a/t/t3600-rm.sh b/t/t3600-rm.sh
new file mode 100755
index 0000000..8415732
--- /dev/null
+++ b/t/t3600-rm.sh
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 Carl D. Worth
+#
+
+test_description='Test of the various options to git-rm.'
+
+. ./test-lib.sh
+
+# Setup some files to be removed
+touch foo bar
+git-add foo bar
+# Need one to test --
+touch -- -q
+git update-index --add -- -q
+git-commit -m "add foo, bar, and -q"
+
+test_expect_success \
+    'Pre-check that foo is in index before git-rm foo' \
+    'git-ls-files --error-unmatch foo'
+
+test_expect_success \
+    'Test that git-rm foo succeeds' \
+    'git-rm foo'
+
+test_expect_failure \
+    'Post-check that foo is not in index after git-rm foo' \
+    'git-ls-files --error-unmatch foo'
+
+test_expect_success \
+    'Test that "git-rm -f bar" works' \
+    'git-rm -f bar'
+
+test_expect_failure \
+    'Post-check that bar no longer exists' \
+    '[ -f bar ]'
+
+test_expect_success \
+    'Test that "git-rm -- -q" works to delete a file named -q' \
+    'git-rm -- -q'
+
+test_done

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Martin Langhoff @ 2006-02-21 23:00 UTC (permalink / raw)
  To: Johannes Schindelin
  Cc: Alex Riesen, Sam Vilain, Junio C Hamano, Eric Wong, git
In-Reply-To: <Pine.LNX.4.63.0602212315400.12634@wbgn013.biozentrum.uni-wuerzburg.de>

On 2/22/06, Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Maybe I am stating the obvious, but it seems that
>
>         open (F, "git-blabla -option |");
>
> would be more portable.


And

    open (F, "git-blabla|", '-option', '$%!|');

would be portable AND safe ;-)

cheers,


martin

^ permalink raw reply

* Re: [PATCH] Add new git-rm command with documentation
From: Carl Worth @ 2006-02-21 22:49 UTC (permalink / raw)
  To: Krzysiek Pawlik; +Cc: Junio C Hamano, git
In-Reply-To: <43FB8F31.9090302@people.pl>

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

On Tue, 21 Feb 2006 23:07:45 +0100, Krzysiek Pawlik wrote:
> 
> I've modified it a little - it has now a '-f' option to delete files
> (much like cvs rm behaviour).

As is, without -f, git-rm will instead act just like git-update-index.

If the -f option is desired we could get the correct behavior by using
update-index --force-remove when not given -f and update-index
--remove when given -f.

That's enough complexity to warrant a test case. I'll be back shortly
with that...

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply

* Re: What does this error message mean?
From: Timo Hirvonen @ 2006-02-21 22:46 UTC (permalink / raw)
  To: git; +Cc: git
In-Reply-To: <200602212206.36685.alan@chandlerfamily.org.uk>

On Tue, 21 Feb 2006 22:06:36 +0000
Alan Chandler <alan@chandlerfamily.org.uk> wrote:

> alan@kanger usermgr[master]$ git commit -a
> fatal: empty ident  <alan@chandlerfamily.org.uk> not allowed
> 
> Suddenly started happening, possibly after upgrade (via debian) to git 1.2.1

Your GIT_AUTHOR_NAME is empty?

-- 
http://onion.dynserv.net/~timo/

^ permalink raw reply

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Sam Vilain @ 2006-02-21 22:38 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Junio C Hamano, Johannes Schindelin, Eric Wong, git
In-Reply-To: <20060221215742.GA5948@steel.home>

Alex Riesen wrote:
>>>Does not work here (ActiveState Build 811, Perl 5.8.6):
>>>$ perl -e 'open(F, "-|")'
>>>'-' is not recognized as an internal or external command,
>>>operable program or batch file.
>>Portability, Ease of Coding, Few CPAN Module Dependencies.  Pick any two.
> Sometimes an upgrade is just out of question. Besides, that'd mean an
> upgrade to another operating system, because very important scripts
> over here a just not portable to anything else but
>     "ActiveState Perl on Windows (TM)"
> I just have no choice.

Sure, but perhaps IPC::Open2 or some other CPAN module has solved this 
problem already.

I guess what I'm saying is that if you want to limit the modules that 
Perl script uses, you end up either impacting on the portability of the 
script or rediscovering problems with early wheel designs.

Sam.

^ permalink raw reply

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Shawn Pearce @ 2006-02-21 22:38 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: git
In-Reply-To: <Pine.LNX.4.63.0602212315400.12634@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Maybe I am stating the obvious, but it seems that
> 
> 	open (F, "git-blabla -option |");
> 
> would be more portable.

Yes but that gets broken up and processed according to your shell.
Which could be ugly if you try to include shell meta-characters.
On the other hand if the entire string passed to open is a constant
in the script then there's really no danger and it would be more
portable.
 
> P.S.: Eric, we rely on fork() anyway. Most of git's programs just don't 
> work without a fork().

Which is why GIT requires Cygwin on Windows.  So why not use
the Cygwin perl when using GIT?  I think that uses Cygwin's fork
emulation to implement fork, rather than the ActiveState emulation
of fork.

Of course fork on Cygwin is painfully slow.  :-|

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] Add new git-rm command with documentation
From: Krzysiek Pawlik @ 2006-02-21 22:36 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: cworth, git
In-Reply-To: <20060221223254.GB20744@spearce.org>


[-- Attachment #1.1: Type: text/plain, Size: 326 bytes --]

Shawn Pearce wrote:
> You are leaving -- in $@ for processing later, which means we'll
> try to delete the file '--'.  :-)
> 
> I think a shift before the break in the -- case would fix this.

Yay! Another stupid mistake from me ;) Thanks again :)

-- 
Krzysiek Pawlik (Nelchael)
RLU #322999 GPG Key ID: 0xBC555551

[-- Attachment #1.2: git-rm.patch --]
[-- Type: text/plain, Size: 4287 bytes --]

diff -Nru git-1.2.2/.gitignore git-1.2.2.patched/.gitignore
--- git-1.2.2/.gitignore	2006-02-19 01:19:00.000000000 +0100
+++ git-1.2.2.patched/.gitignore	2006-02-21 22:56:23.000000000 +0100
@@ -84,6 +84,7 @@
 git-rev-list
 git-rev-parse
 git-revert
+git-rm
 git-send-email
 git-send-pack
 git-sh-setup
diff -Nru git-1.2.2/Documentation/git-rm.txt git-1.2.2.patched/Documentation/git-rm.txt
--- git-1.2.2/Documentation/git-rm.txt	1970-01-01 01:00:00.000000000 +0100
+++ git-1.2.2.patched/Documentation/git-rm.txt	2006-02-21 23:00:13.000000000 +0100
@@ -0,0 +1,80 @@
+git-rm(1)
+=========
+
+NAME
+----
+git-rm - Remove files from the index.
+
+SYNOPSIS
+--------
+'git-rm' [-n|-f] [-v] <file>...
+
+DESCRIPTION
+-----------
+A convenience wrapper for rm and git-update-index --remove. For those
+coming from cvs, git-rm provides an operation similar to "cvs rm -f".
+
+
+OPTIONS
+-------
+<file>...::
+	Files to remove from the working tree and the index.
+
+-n::
+        Don't actually remove the file(s), just show if they exist in
+        the index.
+
+-f::
+        Delete the file(s) before removing it.
+
+-v::
+        Be verbose.
+
+
+DISCUSSION
+----------
+
+The list of <file> given to the command is fed to `git-ls-files`
+command to list files that are registered in the index and
+are not ignored/excluded by `$GIT_DIR/info/exclude` file or
+`.gitignore` file in each directory.  This means two things:
+
+. You can put the name of a directory on the command line, and the
+  command will remove all files in it and its subdirectories (the
+  directories themselves are not removed);
+
+. Giving the name of a file that is not in the index does not
+  remove that file.
+
+
+EXAMPLES
+--------
+git-rm Documentation/\\*.txt::
+
+	Removes all `\*.txt` files that are in the index under
+	`Documentation` directory and its subdirectories.
++
+Note that the asterisk `\*` is quoted from the shell in this
+example; this lets the command include the files from
+subdirectories of `Documentation/` directory.
+
+git-rm git-*.sh::
+
+	Remove all git-*.sh scripts that are in the index.
+	Because this example lets the shell expand the asterisk
+	(i.e. you are listing the files explicitly), it does not
+	remove `subdir/git-foo.sh`.
+
+
+Author
+------
+Written by Linus Torvalds <torvalds@osdl.org>
+
+Documentation
+--------------
+Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff -Nru git-1.2.2/Makefile git-1.2.2.patched/Makefile
--- git-1.2.2/Makefile	2006-02-19 01:19:00.000000000 +0100
+++ git-1.2.2.patched/Makefile	2006-02-21 22:56:23.000000000 +0100
@@ -107,7 +107,7 @@
 	git-merge-one-file.sh git-parse-remote.sh \
 	git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
 	git-repack.sh git-request-pull.sh git-reset.sh \
-	git-resolve.sh git-revert.sh git-sh-setup.sh \
+	git-resolve.sh git-revert.sh git-rm.sh git-sh-setup.sh \
 	git-tag.sh git-verify-tag.sh git-whatchanged.sh \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
diff -Nru git-1.2.2/git-rm.sh git-1.2.2.patched/git-rm.sh
--- git-1.2.2/git-rm.sh	1970-01-01 01:00:00.000000000 +0100
+++ git-1.2.2.patched/git-rm.sh	2006-02-21 23:35:11.000000000 +0100
@@ -0,0 +1,66 @@
+#!/bin/sh
+
+USAGE='<file>...'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
+show_only=
+verbose=
+remove_files=
+while : ; do
+  case "$1" in
+    -n)
+	show_only=true
+	;;
+    -v)
+	verbose=--verbose
+	;;
+    -f)
+	remove_files=true
+	;;
+    --)
+	shift
+	break
+	;;
+    -*)
+	usage
+	;;
+    *)
+	break
+	;;
+  esac
+  shift
+done
+
+# This is typo-proofing. If some paths match and some do not, we want
+# to do nothing.
+case "$#" in
+0)	;;
+*)
+	git-ls-files --error-unmatch -- "$@" >/dev/null || {
+		echo >&2 "Maybe you misspelled it?"
+		exit 1
+	}
+	;;
+esac
+
+files=$(
+    if test -f "$GIT_DIR/info/exclude" ; then
+	git-ls-files \
+	    --exclude-from="$GIT_DIR/info/exclude" \
+	    --exclude-per-directory=.gitignore -- "$@"
+    else
+	git-ls-files \
+	--exclude-per-directory=.gitignore -- "$@"
+    fi | sort | uniq
+)
+
+case "$show_only" in
+true)
+	echo $files
+	;;
+*)
+	[[ "$remove_files" = "true" ]] && rm -f -- $files
+	git-update-index --remove $verbose $files
+	;;
+esac

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Eric Wong @ 2006-02-21 22:35 UTC (permalink / raw)
  To: Johannes Schindelin; +Cc: Alex Riesen, Sam Vilain, Junio C Hamano, git
In-Reply-To: <Pine.LNX.4.63.0602212315400.12634@wbgn013.biozentrum.uni-wuerzburg.de>

Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:
> Hi,
> 
> On Tue, 21 Feb 2006, Alex Riesen wrote:
> 
> > Sam Vilain, Tue, Feb 21, 2006 21:36:50 +0100:
> > > >
> > > >>* Eric, thanks for the hint.  I have this four-patch series.
> > > >>  Could people with perl 5.6 please check them?
> > > >
> > > >
> > > >Does not work here (ActiveState Build 811, Perl 5.8.6):
> > > >
> > > >$ perl -e 'open(F, "-|")'
> > > >'-' is not recognized as an internal or external command,
> > > >operable program or batch file.
> > > 
> > > Portability, Ease of Coding, Few CPAN Module Dependencies.  Pick any two.
> > > 
> > 
> > Sometimes an upgrade is just out of question. Besides, that'd mean an
> > upgrade to another operating system, because very important scripts
> > over here a just not portable to anything else but
> >     "ActiveState Perl on Windows (TM)"
> > I just have no choice.
> 
> Maybe I am stating the obvious, but it seems that
> 
> 	open (F, "git-blabla -option |");
> 
> would be more portable.
> 
> Alex, would this work on ActiveState?
> 
> Perl gurus, is the latter way to open a pipe considered awful or what?

It's OK as long as all arguments are are shell-safe (quoted/escaped
properly).  Shouldn't be a problem with constant strings at all.

> P.S.: Eric, we rely on fork() anyway. Most of git's programs just don't 
> work without a fork().

Yes, apparently there's some fork() emulation in some *doze places and
not others.

-- 
Eric Wong

^ permalink raw reply

* Re: [PATCH] Add new git-rm command with documentation
From: Shawn Pearce @ 2006-02-21 22:32 UTC (permalink / raw)
  To: Krzysiek Pawlik; +Cc: cworth, git
In-Reply-To: <43FB9455.6010402@people.pl>

Krzysiek Pawlik <krzysiek.pawlik@people.pl> wrote:
[...]
> +while : ; do
> +  case "$1" in
> +    -n)
> +	show_only=true
> +	;;
> +    -v)
> +	verbose=--verbose
> +	;;
> +    -f)
> +	remove_files=true
> +	;;
> +    --)
> +	break
> +	;;
> +    -*)
> +	usage
> +	;;
> +    *)
> +	break
> +	;;
> +  esac
> +  shift
> +done
[...]

You are leaving -- in $@ for processing later, which means we'll
try to delete the file '--'.  :-)

I think a shift before the break in the -- case would fix this.

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] Add new git-rm command with documentation
From: Krzysiek Pawlik @ 2006-02-21 22:29 UTC (permalink / raw)
  To: Shawn Pearce; +Cc: cworth, git
In-Reply-To: <20060221221446.GA20744@spearce.org>


[-- Attachment #1.1: Type: text/plain, Size: 408 bytes --]

Shawn Pearce wrote:
> How about supporting -- to break out of the option loop?  The rest
> of the script will support files named --help just fine but the
> option parser will just spit out usage information.

Yeah... forgot to add this.

> Also I don't think the -f option's whitespace matches the others...

Thanks, fixed :)

-- 
Krzysiek Pawlik (Nelchael)
RLU #322999 GPG Key ID: 0xBC555551

[-- Attachment #1.2: git-rm.patch --]
[-- Type: text/plain, Size: 4279 bytes --]

diff -Nru git-1.2.2/.gitignore git-1.2.2.patched/.gitignore
--- git-1.2.2/.gitignore	2006-02-19 01:19:00.000000000 +0100
+++ git-1.2.2.patched/.gitignore	2006-02-21 22:56:23.000000000 +0100
@@ -84,6 +84,7 @@
 git-rev-list
 git-rev-parse
 git-revert
+git-rm
 git-send-email
 git-send-pack
 git-sh-setup
diff -Nru git-1.2.2/Documentation/git-rm.txt git-1.2.2.patched/Documentation/git-rm.txt
--- git-1.2.2/Documentation/git-rm.txt	1970-01-01 01:00:00.000000000 +0100
+++ git-1.2.2.patched/Documentation/git-rm.txt	2006-02-21 23:00:13.000000000 +0100
@@ -0,0 +1,80 @@
+git-rm(1)
+=========
+
+NAME
+----
+git-rm - Remove files from the index.
+
+SYNOPSIS
+--------
+'git-rm' [-n|-f] [-v] <file>...
+
+DESCRIPTION
+-----------
+A convenience wrapper for rm and git-update-index --remove. For those
+coming from cvs, git-rm provides an operation similar to "cvs rm -f".
+
+
+OPTIONS
+-------
+<file>...::
+	Files to remove from the working tree and the index.
+
+-n::
+        Don't actually remove the file(s), just show if they exist in
+        the index.
+
+-f::
+        Delete the file(s) before removing it.
+
+-v::
+        Be verbose.
+
+
+DISCUSSION
+----------
+
+The list of <file> given to the command is fed to `git-ls-files`
+command to list files that are registered in the index and
+are not ignored/excluded by `$GIT_DIR/info/exclude` file or
+`.gitignore` file in each directory.  This means two things:
+
+. You can put the name of a directory on the command line, and the
+  command will remove all files in it and its subdirectories (the
+  directories themselves are not removed);
+
+. Giving the name of a file that is not in the index does not
+  remove that file.
+
+
+EXAMPLES
+--------
+git-rm Documentation/\\*.txt::
+
+	Removes all `\*.txt` files that are in the index under
+	`Documentation` directory and its subdirectories.
++
+Note that the asterisk `\*` is quoted from the shell in this
+example; this lets the command include the files from
+subdirectories of `Documentation/` directory.
+
+git-rm git-*.sh::
+
+	Remove all git-*.sh scripts that are in the index.
+	Because this example lets the shell expand the asterisk
+	(i.e. you are listing the files explicitly), it does not
+	remove `subdir/git-foo.sh`.
+
+
+Author
+------
+Written by Linus Torvalds <torvalds@osdl.org>
+
+Documentation
+--------------
+Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff -Nru git-1.2.2/Makefile git-1.2.2.patched/Makefile
--- git-1.2.2/Makefile	2006-02-19 01:19:00.000000000 +0100
+++ git-1.2.2.patched/Makefile	2006-02-21 22:56:23.000000000 +0100
@@ -107,7 +107,7 @@
 	git-merge-one-file.sh git-parse-remote.sh \
 	git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
 	git-repack.sh git-request-pull.sh git-reset.sh \
-	git-resolve.sh git-revert.sh git-sh-setup.sh \
+	git-resolve.sh git-revert.sh git-rm.sh git-sh-setup.sh \
 	git-tag.sh git-verify-tag.sh git-whatchanged.sh \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
diff -Nru git-1.2.2/git-rm.sh git-1.2.2.patched/git-rm.sh
--- git-1.2.2/git-rm.sh	1970-01-01 01:00:00.000000000 +0100
+++ git-1.2.2.patched/git-rm.sh	2006-02-21 23:25:47.000000000 +0100
@@ -0,0 +1,65 @@
+#!/bin/sh
+
+USAGE='<file>...'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
+show_only=
+verbose=
+remove_files=
+while : ; do
+  case "$1" in
+    -n)
+	show_only=true
+	;;
+    -v)
+	verbose=--verbose
+	;;
+    -f)
+	remove_files=true
+	;;
+    --)
+	break
+	;;
+    -*)
+	usage
+	;;
+    *)
+	break
+	;;
+  esac
+  shift
+done
+
+# This is typo-proofing. If some paths match and some do not, we want
+# to do nothing.
+case "$#" in
+0)	;;
+*)
+	git-ls-files --error-unmatch -- "$@" >/dev/null || {
+		echo >&2 "Maybe you misspelled it?"
+		exit 1
+	}
+	;;
+esac
+
+files=$(
+    if test -f "$GIT_DIR/info/exclude" ; then
+	git-ls-files \
+	    --exclude-from="$GIT_DIR/info/exclude" \
+	    --exclude-per-directory=.gitignore -- "$@"
+    else
+	git-ls-files \
+	--exclude-per-directory=.gitignore -- "$@"
+    fi | sort | uniq
+)
+
+case "$show_only" in
+true)
+	echo $files
+	;;
+*)
+	[[ "$remove_files" = "true" ]] && rm -f -- $files
+	git-update-index --remove $verbose $files
+	;;
+esac

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Johannes Schindelin @ 2006-02-21 22:19 UTC (permalink / raw)
  To: Alex Riesen; +Cc: Sam Vilain, Junio C Hamano, Eric Wong, git
In-Reply-To: <20060221215742.GA5948@steel.home>

Hi,

On Tue, 21 Feb 2006, Alex Riesen wrote:

> Sam Vilain, Tue, Feb 21, 2006 21:36:50 +0100:
> > >
> > >>* Eric, thanks for the hint.  I have this four-patch series.
> > >>  Could people with perl 5.6 please check them?
> > >
> > >
> > >Does not work here (ActiveState Build 811, Perl 5.8.6):
> > >
> > >$ perl -e 'open(F, "-|")'
> > >'-' is not recognized as an internal or external command,
> > >operable program or batch file.
> > 
> > Portability, Ease of Coding, Few CPAN Module Dependencies.  Pick any two.
> > 
> 
> Sometimes an upgrade is just out of question. Besides, that'd mean an
> upgrade to another operating system, because very important scripts
> over here a just not portable to anything else but
>     "ActiveState Perl on Windows (TM)"
> I just have no choice.

Maybe I am stating the obvious, but it seems that

	open (F, "git-blabla -option |");

would be more portable.

Alex, would this work on ActiveState?

Perl gurus, is the latter way to open a pipe considered awful or what?

Ciao,
Dscho

P.S.: Eric, we rely on fork() anyway. Most of git's programs just don't 
work without a fork().

^ permalink raw reply

* Re: PATCH: fix git-fmt-merge-msg on ActiveState Perl
From: Alex Riesen @ 2006-02-21 22:18 UTC (permalink / raw)
  To: Git Mailing List; +Cc: Junio C Hamano
In-Reply-To: <81b0412b0602210748t76d02007s316081a04ee685c8@mail.gmail.com>

Alex Riesen, Tue, Feb 21, 2006 16:48:43 +0100:
> On 2/21/06, Alex Riesen <raa.lkml@gmail.com> wrote:
> > For people who stuck with ActiveState Perl, as there seem to be
> > no chance for it to support the list form of "open" in foreseeable future.
> 
> Too late... Sorry :)

Not too late, actually. It'll work for everyone with ActiveState Perl

^ permalink raw reply

* Re: [PATCH] Add new git-rm command with documentation
From: Johannes Schindelin @ 2006-02-21 22:15 UTC (permalink / raw)
  To: Carl Worth; +Cc: Junio C Hamano, git
In-Reply-To: <87u0ass7tj.wl%cworth@cworth.org>

Hi,

On Tue, 21 Feb 2006, Carl Worth wrote:

>  PS. I didn't change the Linus and Junio attribution since all of the
>  code and documentation here is just minor changes from git-add.

If that is so, why not reuse the same binary (a la git-whatchanged and 
git-show)?

Ciao,
Dscho

^ permalink raw reply

* Re: [PATCH] Add new git-rm command with documentation
From: Shawn Pearce @ 2006-02-21 22:14 UTC (permalink / raw)
  To: Krzysiek Pawlik; +Cc: Carl Worth, git
In-Reply-To: <43FB8F31.9090302@people.pl>

How about supporting -- to break out of the option loop?  The rest
of the script will support files named --help just fine but the
option parser will just spit out usage information.

[...]
> +while : ; do
> +  case "$1" in
> +    -n)
> +	show_only=true
> +	;;
> +    -v)
> +	verbose=--verbose
> +	;;
> +	-f)
> +	remove_files=true
> +	;;
> +    -*)
> +	usage
> +	;;
> +    *)
> +	break
> +	;;
> +  esac
> +  shift
> +done
[...]

Also I don't think the -f option's whitespace matches the others...

-- 
Shawn.

^ permalink raw reply

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Ron Parker @ 2006-02-21 22:13 UTC (permalink / raw)
  To: git
In-Reply-To: <1cf1c57a0602211412r1988b14ao435edd29207dc0d0@mail.gmail.com>

On 2/21/06, Alex Riesen <raa.lkml@gmail.com> wrote:

> AFAICS, it does not exist. There is emulation of it in that active-perl,
> though so this works:
>
>     if ( !fork ) { something }
>
> but not "too well" (you have to be carefule not spawn too many (which
> is around 50) processes. Perl'll crash otherwise).

IIRC this has to do with some child-process thread limits in Windows.

--
Windows, the multi-thrashing OS.

^ permalink raw reply

* Re: [PATCH] Add new git-rm command with documentation
From: Krzysiek Pawlik @ 2006-02-21 22:07 UTC (permalink / raw)
  To: Carl Worth; +Cc: Junio C Hamano, git
In-Reply-To: <87u0ass7tj.wl%cworth@cworth.org>


[-- Attachment #1.1: Type: text/plain, Size: 376 bytes --]

Carl Worth wrote:
> This adds a git-rm command which provides convenience similar to
> git-add

I've modified it a little - it has now a '-f' option to delete files
(much like cvs rm behaviour). It makes it a bit safer ;) I've fixed the
`rm` - it wouldn't work for example for file named '--help'.

-- 
Krzysiek Pawlik (Nelchael)
RLU #322999 GPG Key ID: 0xBC555551

[-- Attachment #1.2: git-rm.patch --]
[-- Type: text/plain, Size: 4254 bytes --]

diff -Nru git-1.2.2/.gitignore git-1.2.2.patched/.gitignore
--- git-1.2.2/.gitignore	2006-02-19 01:19:00.000000000 +0100
+++ git-1.2.2.patched/.gitignore	2006-02-21 22:56:23.000000000 +0100
@@ -84,6 +84,7 @@
 git-rev-list
 git-rev-parse
 git-revert
+git-rm
 git-send-email
 git-send-pack
 git-sh-setup
diff -Nru git-1.2.2/Documentation/git-rm.txt git-1.2.2.patched/Documentation/git-rm.txt
--- git-1.2.2/Documentation/git-rm.txt	1970-01-01 01:00:00.000000000 +0100
+++ git-1.2.2.patched/Documentation/git-rm.txt	2006-02-21 23:00:13.000000000 +0100
@@ -0,0 +1,80 @@
+git-rm(1)
+=========
+
+NAME
+----
+git-rm - Remove files from the index.
+
+SYNOPSIS
+--------
+'git-rm' [-n|-f] [-v] <file>...
+
+DESCRIPTION
+-----------
+A convenience wrapper for rm and git-update-index --remove. For those
+coming from cvs, git-rm provides an operation similar to "cvs rm -f".
+
+
+OPTIONS
+-------
+<file>...::
+	Files to remove from the working tree and the index.
+
+-n::
+        Don't actually remove the file(s), just show if they exist in
+        the index.
+
+-f::
+        Delete the file(s) before removing it.
+
+-v::
+        Be verbose.
+
+
+DISCUSSION
+----------
+
+The list of <file> given to the command is fed to `git-ls-files`
+command to list files that are registered in the index and
+are not ignored/excluded by `$GIT_DIR/info/exclude` file or
+`.gitignore` file in each directory.  This means two things:
+
+. You can put the name of a directory on the command line, and the
+  command will remove all files in it and its subdirectories (the
+  directories themselves are not removed);
+
+. Giving the name of a file that is not in the index does not
+  remove that file.
+
+
+EXAMPLES
+--------
+git-rm Documentation/\\*.txt::
+
+	Removes all `\*.txt` files that are in the index under
+	`Documentation` directory and its subdirectories.
++
+Note that the asterisk `\*` is quoted from the shell in this
+example; this lets the command include the files from
+subdirectories of `Documentation/` directory.
+
+git-rm git-*.sh::
+
+	Remove all git-*.sh scripts that are in the index.
+	Because this example lets the shell expand the asterisk
+	(i.e. you are listing the files explicitly), it does not
+	remove `subdir/git-foo.sh`.
+
+
+Author
+------
+Written by Linus Torvalds <torvalds@osdl.org>
+
+Documentation
+--------------
+Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff -Nru git-1.2.2/Makefile git-1.2.2.patched/Makefile
--- git-1.2.2/Makefile	2006-02-19 01:19:00.000000000 +0100
+++ git-1.2.2.patched/Makefile	2006-02-21 22:56:23.000000000 +0100
@@ -107,7 +107,7 @@
 	git-merge-one-file.sh git-parse-remote.sh \
 	git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
 	git-repack.sh git-request-pull.sh git-reset.sh \
-	git-resolve.sh git-revert.sh git-sh-setup.sh \
+	git-resolve.sh git-revert.sh git-rm.sh git-sh-setup.sh \
 	git-tag.sh git-verify-tag.sh git-whatchanged.sh \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
diff -Nru git-1.2.2/git-rm.sh git-1.2.2.patched/git-rm.sh
--- git-1.2.2/git-rm.sh	1970-01-01 01:00:00.000000000 +0100
+++ git-1.2.2.patched/git-rm.sh	2006-02-21 23:02:13.000000000 +0100
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+USAGE='<file>...'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
+show_only=
+verbose=
+remove_files=
+while : ; do
+  case "$1" in
+    -n)
+	show_only=true
+	;;
+    -v)
+	verbose=--verbose
+	;;
+	-f)
+	remove_files=true
+	;;
+    -*)
+	usage
+	;;
+    *)
+	break
+	;;
+  esac
+  shift
+done
+
+# This is typo-proofing. If some paths match and some do not, we want
+# to do nothing.
+case "$#" in
+0)	;;
+*)
+	git-ls-files --error-unmatch -- "$@" >/dev/null || {
+		echo >&2 "Maybe you misspelled it?"
+		exit 1
+	}
+	;;
+esac
+
+files=$(
+    if test -f "$GIT_DIR/info/exclude" ; then
+	git-ls-files \
+	    --exclude-from="$GIT_DIR/info/exclude" \
+	    --exclude-per-directory=.gitignore -- "$@"
+    else
+	git-ls-files \
+	--exclude-per-directory=.gitignore -- "$@"
+    fi | sort | uniq
+)
+
+case "$show_only" in
+true)
+	echo $files
+	;;
+*)
+	[[ "$remove_files" = "true" ]] && rm -f -- $files
+	git-update-index --remove $verbose $files
+	;;
+esac

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 191 bytes --]

^ permalink raw reply

* What does this error message mean?
From: Alan Chandler @ 2006-02-21 22:06 UTC (permalink / raw)
  To: git

alan@kanger usermgr[master]$ git commit -a
fatal: empty ident  <alan@chandlerfamily.org.uk> not allowed

Suddenly started happening, possibly after upgrade (via debian) to git 1.2.1



-- 
Alan Chandler
http://www.chandlerfamily.org.uk
Open Source. It's the difference between trust and antitrust.

^ permalink raw reply

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Alex Riesen @ 2006-02-21 22:04 UTC (permalink / raw)
  To: Eric Wong; +Cc: Junio C Hamano, Johannes Schindelin, git
In-Reply-To: <20060221205618.GA23920@localdomain>

Eric Wong, Tue, Feb 21, 2006 21:56:18 +0100:
> > >  * Eric, thanks for the hint.  I have this four-patch series.
> > >    Could people with perl 5.6 please check them?
> > 
> > Does not work here (ActiveState Build 811, Perl 5.8.6):
> > 
> > $ perl -e 'open(F, "-|")'
> > '-' is not recognized as an internal or external command,
> > operable program or batch file.
> 
> Both "-|" and "|-" forms of open() use fork() internally.  Iirc, fork()
> doesn't work too well on that platform.
> 

AFAICS, it does not exist. There is emulation of it in that active-perl,
though so this works:

    if ( !fork ) { something }

but not "too well" (you have to be carefule not spawn too many (which
is around 50) processes. Perl'll crash otherwise).

^ permalink raw reply

* Re: [PATCH] fmt-merge-msg: avoid open "-|" list form for Perl 5.6
From: Alex Riesen @ 2006-02-21 21:57 UTC (permalink / raw)
  To: Sam Vilain; +Cc: Junio C Hamano, Johannes Schindelin, Eric Wong, git
In-Reply-To: <43FB79E2.1040307@vilain.net>

Sam Vilain, Tue, Feb 21, 2006 21:36:50 +0100:
> >
> >>* Eric, thanks for the hint.  I have this four-patch series.
> >>  Could people with perl 5.6 please check them?
> >
> >
> >Does not work here (ActiveState Build 811, Perl 5.8.6):
> >
> >$ perl -e 'open(F, "-|")'
> >'-' is not recognized as an internal or external command,
> >operable program or batch file.
> 
> Portability, Ease of Coding, Few CPAN Module Dependencies.  Pick any two.
> 

Sometimes an upgrade is just out of question. Besides, that'd mean an
upgrade to another operating system, because very important scripts
over here a just not portable to anything else but
    "ActiveState Perl on Windows (TM)"
I just have no choice.

^ permalink raw reply

* [PATCH] Add new git-rm command with documentation
From: Carl Worth @ 2006-02-21 21:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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

This adds a git-rm command which provides convenience similar to
git-add, (and a bit more since it takes care of the rm as well).

Like git-add, git-rm expands the given path names through
git-ls-files. This means it only acts on files listed in the
index. And it does act recursively on directories by default, (no -r
needed as in the case of rm itself). When it recurses, it does not
remove empty directories that are left behind.

---

 It wouldn't be too hard to make this act more like rm in requiring -r
 before recursing into directories. Let me know what people think
 about this.

 As before, if you'd prefer to fetch/pull this, you should be able to
 from:

	git://git.freedesktop.org/~cworth/git

 This time on the git-rm branch, (again merged into cworth for what
 that's worth).

 -Carl

 PS. I didn't change the Linus and Junio attribution since all of the
 code and documentation here is just minor changes from git-add.

 .gitignore               |    1 +
 Documentation/git-rm.txt |   77 ++++++++++++++++++++++++++++++++++++++++++++++
 Makefile                 |    2 +
 git-rm.sh                |   58 +++++++++++++++++++++++++++++++++++
 4 files changed, 137 insertions(+), 1 deletions(-)
 create mode 100644 Documentation/git-rm.txt
 create mode 100644 git-rm.sh

cf3ff7a87defa6ced7e6a8b6d719a9f237a08314
diff --git a/.gitignore b/.gitignore
index d7e8d2a..94f66d5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -84,6 +84,7 @@ git-resolve
 git-rev-list
 git-rev-parse
 git-revert
+git-rm
 git-send-email
 git-send-pack
 git-sh-setup
diff --git a/Documentation/git-rm.txt b/Documentation/git-rm.txt
new file mode 100644
index 0000000..6095df8
--- /dev/null
+++ b/Documentation/git-rm.txt
@@ -0,0 +1,77 @@
+git-rm(1)
+=========
+
+NAME
+----
+git-rm - Remove files from the working tree and from the index.
+
+SYNOPSIS
+--------
+'git-rm' [-n] [-v] <file>...
+
+DESCRIPTION
+-----------
+A convenience wrapper for rm and git-update-index --remove. For those
+coming from cvs, git-rm provides an operation similar to "cvs rm -f".
+
+
+OPTIONS
+-------
+<file>...::
+	Files to remove from the working tree and the index.
+
+-n::
+        Don't actually remove the file(s), just show if they exist in
+        the index.
+
+-v::
+        Be verbose.
+
+
+DISCUSSION
+----------
+
+The list of <file> given to the command is fed to `git-ls-files`
+command to list files that are registered in the index and
+are not ignored/excluded by `$GIT_DIR/info/exclude` file or
+`.gitignore` file in each directory.  This means two things:
+
+. You can put the name of a directory on the command line, and the
+  command will remove all files in it and its subdirectories (the
+  directories themselves are not removed);
+
+. Giving the name of a file that is not in the index does not
+  remove that file.
+
+
+EXAMPLES
+--------
+git-rm Documentation/\\*.txt::
+
+	Removes all `\*.txt` files that are in the index under
+	`Documentation` directory and its subdirectories.
++
+Note that the asterisk `\*` is quoted from the shell in this
+example; this lets the command include the files from
+subdirectories of `Documentation/` directory.
+
+git-rm git-*.sh::
+
+	Remove all git-*.sh scripts that are in the index.
+	Because this example lets the shell expand the asterisk
+	(i.e. you are listing the files explicitly), it does not
+	remove `subdir/git-foo.sh`.
+
+
+Author
+------
+Written by Linus Torvalds <torvalds@osdl.org>
+
+Documentation
+--------------
+Documentation by Junio C Hamano and the git-list <git@vger.kernel.org>.
+
+GIT
+---
+Part of the gitlink:git[7] suite
+
diff --git a/Makefile b/Makefile
index 317be3c..e98b056 100644
--- a/Makefile
+++ b/Makefile
@@ -109,7 +109,7 @@ SCRIPT_SH = \
 	git-merge-one-file.sh git-parse-remote.sh \
 	git-prune.sh git-pull.sh git-push.sh git-rebase.sh \
 	git-repack.sh git-request-pull.sh git-reset.sh \
-	git-resolve.sh git-revert.sh git-sh-setup.sh \
+	git-resolve.sh git-revert.sh git-rm.sh git-sh-setup.sh \
 	git-tag.sh git-verify-tag.sh git-whatchanged.sh \
 	git-applymbox.sh git-applypatch.sh git-am.sh \
 	git-merge.sh git-merge-stupid.sh git-merge-octopus.sh \
diff --git a/git-rm.sh b/git-rm.sh
new file mode 100644
index 0000000..840c458
--- /dev/null
+++ b/git-rm.sh
@@ -0,0 +1,58 @@
+#!/bin/sh
+
+USAGE='<file>...'
+SUBDIRECTORY_OK='Yes'
+. git-sh-setup
+
+show_only=
+verbose=
+while : ; do
+  case "$1" in
+    -n)
+	show_only=true
+	;;
+    -v)
+	verbose=--verbose
+	;;
+    -*)
+	usage
+	;;
+    *)
+	break
+	;;
+  esac
+  shift
+done
+
+# This is typo-proofing. If some paths match and some do not, we want
+# to do nothing.
+case "$#" in
+0)	;;
+*)
+	git-ls-files --error-unmatch -- "$@" >/dev/null || {
+		echo >&2 "Maybe you misspelled it?"
+		exit 1
+	}
+	;;
+esac
+
+files=$(
+    if test -f "$GIT_DIR/info/exclude" ; then
+	git-ls-files \
+	    --exclude-from="$GIT_DIR/info/exclude" \
+	    --exclude-per-directory=.gitignore -- "$@"
+    else
+	git-ls-files \
+	--exclude-per-directory=.gitignore -- "$@"
+    fi | sort | uniq
+)
+
+case "$show_only" in
+true)
+	echo $files
+	;;
+*)
+	rm $files
+	git-update-index --remove $verbose $files
+	;;
+esac
-- 
1.2.2.g73be-dirty


[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply related

* Re: How to not download objects more than needed?
From: Junio C Hamano @ 2006-02-21 21:32 UTC (permalink / raw)
  To: Radoslaw Szkodzinski; +Cc: git
In-Reply-To: <43FB6C42.5000208@gorzow.mm.pl>

Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> writes:

> I have a pecuilar, but common use case for git.
>
> I have linux-2.6 repository pulled and I'd like to download some branch
> (say, netdev-2.6), which uses many of the same objects,
> but not to get all the objects from the git server.
>
> I've already tried certain commands, but still can't do it,
> and my bandwidth isn't too happy about it.
>
> It seems to require some kind of HEAD rewinding,
> or maybe fetching to another branch, I don't know.
>
> Anyone cares to help?

It is not peculiar at all.  The tools already should do what you
want:

           o---o---o---...---o (netdev-2.6)
          /
         / < netdev forked some time ago.
        /
    ---o---o---o---o---...---o---o---o (linus tip)
               ^v2.6.16-rc3      ^v2.6.16-rc4 

Suppose the "global" ancestry graph was like the above.  And
netdev-2.6 has not been merged into Linus tree.

What you have, already pulled from Linus, is:

    ---o---o---o---o---...---o---o---o (linus tip)
               ^v2.6.16-rc3      ^v2.6.16-rc4 

And suppose what the netdev tree has is something like this:

           o---o---o---...---o (netdev-2.6)
          /
         / < netdev forked some time ago.
        /
    ---o---o---o
               ^v2.6.16-rc3

The point being that the netdev tree does not know about Linus
tip you have.

When you "git fetch git://.../netdev-2.6.git/", a program that
runs on your end (git-fetch-pack) and another program that runs
on the other end (git-upload-pack) discuss to find out what both
of you have in common.  Your side starts from Linus tip and go
backwards, telling the other end "I have this, I have that,
...".  At first, netdev side will not see what it knows about,
but after a while, it will see a commit both of you have
(i.e. where the branch forked from).  After they find that out,
your side tells the other side "I want your netdev-2.6 head".

The other side sends the objects needed to complete the chain up
to the requested head, assuming that your side has objects to
complete the common ancestor point (again, the fork point, but
it could be some revs after that if the graph looked like the
above picture).  Objects behind the fork point does not need to
be sent.

^ permalink raw reply

* Re: How to not download objects more than needed?
From: sean @ 2006-02-21 21:13 UTC (permalink / raw)
  To: Radoslaw Szkodzinski; +Cc: git
In-Reply-To: <43FB6C42.5000208@gorzow.mm.pl>

On Tue, 21 Feb 2006 20:38:42 +0100
Radoslaw Szkodzinski <astralstorm@gorzow.mm.pl> wrote:

> I have a pecuilar, but common use case for git.

It's not really that peculiar.

> I have linux-2.6 repository pulled and I'd like to download some branch
> (say, netdev-2.6), which uses many of the same objects,
> but not to get all the objects from the git server.

Just make sure you're not using the rsync protocol.   Using the
native git protocol would be best.

> I've already tried certain commands, but still can't do it,
> and my bandwidth isn't too happy about it.

For instance, make sure your current linus repository is up to date 
with a "git pull" and then:

git fetch \
   git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git \
   upstream:netdev

will take the "upstream" branch from the netdev repository and name it 
netdev in your local repository.

Sean

^ 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