debcheckout: should create a local tracking branch for pristine-tar

Dominique Dumont dod at debian.org
Mon May 18 11:59:10 UTC 2015


Hello

On Mon, 18 May 2015 00:42:57 +0900 Hideki Yamane <henrich at debian.org> wrote:
>  I've made tiny workaround patch for this issue (and more for with
>  "upstream" branch). Could you check it, please?

This is good start. But it can be improved:

Instead of using 'git checkout', I think you can setup the branches with
'git branch --track'. E.g. 'git branch --track pristine-tar 
remotes/origin/pristine-tar'

An alternative to run 'cd $wcdir' in the forked shell script is to run cd 
within the Perl script:

use Cwd;
my $dir = cwd();
chdir($wcdir) || die;
system(qw/git whatever/) or die "system git whatever failed: $?";
chdir($dir); # go back

This way, you have a better control of the forked command: one command in one 
system call enables you to check for error as shown above.

One last trick: calling system with an array avoid forking a shell: the 
command is run directly, thus you avoid subtitutions problems with bash.

Feel free to get back to me if I was not clear enough.

Hope this helps

-- 
 https://github.com/dod38fr/   -o- http://search.cpan.org/~ddumont/
http://ddumont.wordpress.com/  -o-   irc: dod at irc.debian.org



More information about the devscripts-devel mailing list