[PATCH 2/3] qf: Make qf_pull -f forcibly clean
Lucas De Marchi
lucas.de.marchi at gmail.com
Fri Mar 9 01:41:33 UTC 2018
On Thu, Mar 08, 2018 at 05:25:44PM -0800, Rodrigo Vivi wrote:
> On Thu, Mar 08, 2018 at 07:29:52AM -0800, Lucas De Marchi wrote:
> > On Wed, Mar 07, 2018 at 05:42:54PM -0800, Rodrigo Vivi wrote:
> > > qf_checkout implies that you need to have that baseline
> > > on your local repository, what it is not good for a distributed
> > > maintenance.
> > >
> > > Let's make qf pull -f useful for the case we want to start
> > > a clean rebase from anywhere.
> > >
> > > v2: Remove dubious comments and use -f.
> > >
> > > Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
> > > Cc: Michel Thierry <michel.thierry at intel.com>
> > > Cc: James Ausmus <james.ausmus at intel.com>
> > > Cc: Lucas De Marchi <lucas.demarchi at intel.com>
> > > Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
> > > ---
> > > qf | 23 +++++++++++++++++++++--
> > > 1 file changed, 21 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/qf b/qf
> > > index 270bcf53000a..fb04aeb71428 100755
> > > --- a/qf
> > > +++ b/qf
> > > @@ -404,11 +404,17 @@ function qf_pull
> > > {
> > > cd_toplevel
> > >
> > > - qf fetch
> > > + qf_fetch
> > > cd patches
> > > git pull --ff-only
> > >
> > > - qf co
> > > + if [[ $FORCE ]]; then
> >
> > if we want to force, don't we need to do this before the git pull?
> >
> > if [ $FORCE ]; then
> > git pull --ff-only
>
> Yes, this is probably a good idea. Although the real forced
> version is fetch & reset --hard ;)
not sure I understand. This would work iff this script was not using
'set -e'. Since it is, any command that fails will cause it to exit.
So AFAICS 'git pull --ff-only' would fail and we would not even check by
$FORCE. Am I missing anything?
Lucas De Marchi
>
> >
> > qf co
> >
> > if we want to force, don't we need to do this before the git pull?
>
>
> there is a duplication here on your response that confused me...
> what do you want here besides the git pull --ff-only inside the forced block?
>
>
> >
> >
> > > + git reset --hard HEAD
> > > + else
> > > + qf_co
> > > + fi
> > > +
> > > + cd ..
> >
> >
> > > + git reset --hard HEAD
> > > + else
> > > + qf_co
> > > + fi
> > > +
> > > + cd ..
> > > }
> > >
> > > function qf_stage
> > > @@ -587,6 +593,19 @@ function qf_usage
> > > echo "See '$qf help' for more information."
> > > }
> > >
> > > +FORCE=
> > > +while getopts f opt; do
> > > + case "$opt" in
> > > + f)
> > > + FORCE=1
> >
> > The way you are checking for $FORCE means that even if you assign
> > FORCE=0 the result will be true, which could be misleading (it will only
> > be false if the var is unsed). Maybe here you could do "FORCE=FORCE" or
> > assign 0 first and then in the check do a "if [ $FORCE -eq 1 ];" ?
>
> I agree... just not sure if we should deviate from what is in use on dim.
>
> >
> > Lucas De Marchi
> >
> > > + ;;
> > > + *)
> > > + echo "See '$qf help' for more information."
> > > + exit
> > > + esac
> > > +done
> > > +shift $((OPTIND - 1))
> > > +
> > > # qf subcommand aliases (with bash 4.3+)
> > > if ! declare -n subcmd=qf_alias_${subcommand//-/_} &> /dev/null || \
> > > test -z "${subcmd:-}"; then
> > > --
> > > 2.13.6
> > >
> > > _______________________________________________
> > > dim-tools mailing list
> > > dim-tools at lists.freedesktop.org
> > > https://lists.freedesktop.org/mailman/listinfo/dim-tools
> > _______________________________________________
> > dim-tools mailing list
> > dim-tools at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dim-tools
More information about the dim-tools
mailing list