git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Surovegin <ebs@ebshome.net>
To: Petr Baudis <pasky@ucw.cz>
Cc: git@vger.kernel.org
Subject: Re: [RFC] allow file list editing during cg-commit
Date: Mon, 9 May 2005 15:24:35 -0700	[thread overview]
Message-ID: <20050509222435.GA25901@gate.ebshome.net> (raw)
In-Reply-To: <20050509084606.GD3599@pasky.ji.cz>

On Mon, May 09, 2005 at 10:46:06AM +0200, Petr Baudis wrote:

[snip]

> The only thing to watch out for is that cg-commit -C produces no such
> list at all; it should deal with that and tell the user he is not going
> to be able to control what is going to be committed then.
> 
> Another thing is that at the moment you modify the file list, you should
> set customfiles - otherwise you will commit even cg-adds and cg-rms of
> files you didn't select. But do that really only when you change the
> file list, since it is more expensive.
> 
> You should also place an appropriate hint near the CG: lines, saying
> that removing some of them will limit the list of files to be committed.

OK, how about the following patch? I tried to address all issues you 
mentioned and also $merging case as well.

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

Index: cg-commit
===================================================================
--- 972d8624458936868e6f392b40858b7c362af8cd/cg-commit  (mode:100755)
+++ uncommitted/cg-commit  (mode:100755)
@@ -111,12 +111,16 @@
 		rm $LOGMSG $LOGMSG2
 		die 'Nothing to commit'
 	fi
+	if [ ! "$merging" ]; then
+		echo "CG: By deleting lines beginning with CG:F the associated file" >>$LOGMSG 
+		echo "CG: will be removed from the commit list." >>$LOGMSG 
+	fi	
 	echo "CG:" >>$LOGMSG
 	echo "CG: Modified files:" >>$LOGMSG
 	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 +135,17 @@
 		rm $LOGMSG $LOGMSG2
 		die 'Commit message not modified, commit aborted'
 	fi
+	if [ ! "$ignorecache" ] && [ ! "$merging" ]; then
+		eval newcommitfiles=($(grep ^CG:F $LOGMSG2 | sed 's/^CG:F//'))
+		if [ ! "${newcommitfiles[*]}" ]; then
+			rm $LOGMSG $LOGMSG2
+			die 'Nothing to commit'
+		fi
+		if [ "${commitfiles[*]}" != "${newcommitfiles[*]}" ]; then
+			commitfiles="${newcommitfiles[*]}"
+			customfiles="${commitfiles[*]}"
+		fi
+	fi
 else
 	cat >>$LOGMSG2
 fi


  reply	other threads:[~2005-05-09 22:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-09  4:14 [RFC] allow file list editing during cg-commit Eugene Surovegin
2005-05-09  8:27 ` Marcel Holtmann
2005-05-09  8:33   ` Eugene Surovegin
2005-05-09  8:46   ` Petr Baudis
2005-05-09 22:24     ` Eugene Surovegin [this message]
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=20050509222435.GA25901@gate.ebshome.net \
    --to=ebs@ebshome.net \
    --cc=git@vger.kernel.org \
    --cc=pasky@ucw.cz \
    /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).