}
flag.Usage = func() { usage(os.Args[0]) }
- flag.Parse()
+
+ BuildUUIDStr := os.Getenv(EnvBuildUUID)
+ IsTopRedo = BuildUUIDStr == ""
+
+ var args []string
+ if IsTopRedo {
+ flag.Parse()
+ args = flag.Args()
+ } else {
+ args = os.Args[1:]
+ }
+
if *warranty {
fmt.Println(Warranty)
return
fdDep = mustParseFd(v, EnvDepFd)
}
- tgts := make([]*Tgt, 0, len(flag.Args()))
- for _, arg := range flag.Args() {
+ tgts := make([]*Tgt, 0, len(args))
+ for _, arg := range args {
tgts = append(tgts, NewTgt(arg))
}
tgtsWasEmpty := len(tgts) == 0
- if BuildUUIDStr := os.Getenv(EnvBuildUUID); BuildUUIDStr == "" {
- IsTopRedo = true
+ if BuildUUIDStr == "" {
BuildUUID = uuid.New()
if tgtsWasEmpty {
tgts = append(tgts, NewTgt("all"))
--- /dev/null
+#!/bin/sh
+
+testname=`basename "$0"`
+test_description="Check that dashed targets are not treated as options"
+. $SHARNESS_TEST_SRCDIR/sharness.sh
+export REDO_TOP_DIR="`pwd`" REDO_NO_PROGRESS=1
+
+echo echo \$1 > default.do
+redo -- ok
+test_expect_success "redo skips dashes" '[ ! -e ./-- ]'
+test_expect_success "redo mades ok" '[ -s ok ]'
+
+echo "redo-ifchange -- ok" > foo.do
+rm ok
+redo foo
+test_expect_success "dashes made" '[ -s ./-- ]'
+test_expect_success "ok is also made" '[ -e ok ]'
+
+test_done