git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Surovegin <ebs@ebshome.net>
To: git@vger.kernel.org
Subject: [RFC] allow file list editing during cg-commit
Date: Sun, 8 May 2005 21:14:59 -0700	[thread overview]
Message-ID: <20050509041459.GA13475@gate.ebshome.net> (raw)

Hi!

I just started playing with cogito and failed to find _easy_ way to
select which files will be committed and which won't. cg-commit seems
to support specifying file list in command line, but this isn't very
convenient when the list is big.

I tend to have many modified files in my repo, but commit them in
several different changeset.

I just made simple change to cg-commit which allows  editing file
list while editing log message; for example, if I have 30 files  ready
for commit, but want to commit only 29, I just remove this file
from "CG:" list.

Patch which demonstrates the idea follows. Please note, this is
just a quick hack, and I probably missed some cg-commit cases, when
such behavior is undesirable; also, I cheated a little to make
grepping easy :).

Signed-off-by: Eugene Surovegin <ebs@ebshome.net>

Index: cg-commit
===================================================================
--- 3974261da777f55a7a11aff6e02f584bbfe2b475/cg-commit  (mode:100755)
+++ uncommitted/cg-commit  (mode:100755)
@@ -116,7 +116,7 @@
 	for file in "${commitfiles[@]}"; do
 		# TODO: Prepend a letter describing whether it's addition,
 		# removal or update. Or call git status on those files.
-		echo "CG:    $file" >>$LOGMSG
+		echo "CG:F    $file" >>$LOGMSG
 		[ "$msgs" ] && ! [ "$forceeditor" ] && echo $file
 	done
 fi
@@ -131,6 +131,11 @@
 		rm $LOGMSG $LOGMSG2
 		die 'Commit message not modified, commit aborted'
 	fi
+	eval commitfiles=($(grep ^CG:F $LOGMSG2 | sed 's/^CG:F//'))
+	if [ ! "${commitfiles[*]}" ]; then
+		rm $LOGMSG $LOGMSG2
+		die 'Nothing to commit'
+	fi
 else
 	cat >>$LOGMSG2
 fi

             reply	other threads:[~2005-05-09  4:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-09  4:14 Eugene Surovegin [this message]
2005-05-09  8:27 ` [RFC] allow file list editing during cg-commit Marcel Holtmann
2005-05-09  8:33   ` Eugene Surovegin
2005-05-09  8:46   ` Petr Baudis
2005-05-09 22:24     ` Eugene Surovegin
2005-05-09 15:24 ` Jonas Fonseca

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20050509041459.GA13475@gate.ebshome.net \
    --to=ebs@ebshome.net \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).