@@ -437,61 +437,60 @@ state[]=lfstest:state2"
437
437
)
438
438
end_test
439
439
440
-
441
- if [[ $( uname) == * " MINGW" * ]]; then
442
- NETRCFILE=" $HOME /_netrc"
443
- else
444
- NETRCFILE=" $HOME /.netrc"
440
+ NETRCFILES=" .netrc"
441
+ if [ " $IS_WINDOWS " -eq 1 ]; then
442
+ NETRCFILES+=" _netrc"
445
443
fi
446
444
445
+ for netrcfile in $NETRCFILES ; do
446
+ begin_test " credentials from netrc ($netrcfile )"
447
+ (
448
+ set -e
447
449
448
- begin_test " credentials from netrc"
449
- (
450
- set -e
450
+ printf " machine localhost\nlogin netrcuser\npassword netrcpass\n" > " $HOME /$netrcfile "
451
+ echo $HOME
452
+ echo " GITSERVER $GITSERVER "
453
+ cat " $HOME /$netrcfile "
451
454
452
- printf " machine localhost\nlogin netrcuser\npassword netrcpass\n" >> " $NETRCFILE "
453
- echo $HOME
454
- echo " GITSERVER $GITSERVER "
455
- cat $NETRCFILE
455
+ # prevent prompts on Windows particularly
456
+ export SSH_ASKPASS=
456
457
457
- # prevent prompts on Windows particularly
458
- export SSH_ASKPASS=
458
+ reponame= " netrctest- $netrcfile "
459
+ setup_remote_repo " $reponame "
459
460
460
- reponame=" netrctest"
461
- setup_remote_repo " $reponame "
461
+ clone_repo " $reponame " " ${reponame} -assert"
462
462
463
- clone_repo " $reponame " repo
463
+ # Need a remote named "localhost" or 127.0.0.1 in netrc will interfere with the other auth
464
+ git remote add " netrc" " $( echo $GITSERVER | sed s/127.0.0.1/localhost/) /netrctest"
465
+ git lfs env
464
466
465
- # Need a remote named "localhost" or 127.0.0.1 in netrc will interfere with the other auth
466
- git remote add " netrc" " $( echo $GITSERVER | sed s/127.0.0.1/localhost/) /netrctest"
467
- git lfs env
467
+ git lfs track " *.dat"
468
+ echo " push a" > a.dat
469
+ git add .gitattributes a.dat
470
+ git commit -m " add a.dat"
468
471
469
- git lfs track " *.dat "
470
- echo " push a " > a.dat
471
- git add .gitattributes a.dat
472
- git commit -m " add a.dat "
472
+ GIT_TRACE=1 git lfs push netrc main 2>&1 | tee push.log
473
+ grep " Uploading LFS objects: 100% (1/1), 7 B " push.log
474
+ echo " any netrc credential calls: "
475
+ [ " 4 " -eq " $( cat push.log | grep " netrc: git credential " | wc -l ) " ]
473
476
474
- GIT_TRACE=1 git lfs push netrc main 2>&1 | tee push.log
475
- grep " Uploading LFS objects: 100% (1/1), 7 B" push.log
476
- echo " any netrc credential calls:"
477
- [ " 4" -eq " $( cat push.log | grep " netrc: git credential" | wc -l) " ]
477
+ echo " any netrc credential fills:"
478
+ [ " 2" -eq " $( cat push.log | grep " netrc: git credential fill" | wc -l) " ]
478
479
479
- echo " any netrc credential fills:"
480
- [ " 2" -eq " $( cat push.log | grep " netrc: git credential fill" | wc -l) " ]
481
-
482
- echo " any netrc credential approvals:"
483
- [ " 2" -eq " $( cat push.log | grep " netrc: git credential approve" | wc -l) " ]
484
- )
485
- end_test
480
+ echo " any netrc credential approvals:"
481
+ [ " 2" -eq " $( cat push.log | grep " netrc: git credential approve" | wc -l) " ]
482
+ )
483
+ end_test
484
+ done
486
485
487
486
begin_test " credentials from netrc with unknown keyword"
488
487
(
489
488
set -e
490
489
491
- printf " machine localhost\nlogin netrcuser\nnot-a-key something\npassword netrcpass\n" >> " $NETRCFILE "
490
+ printf " machine localhost\nlogin netrcuser\nnot-a-key something\npassword netrcpass\n" > " $HOME /.netrc "
492
491
echo $HOME
493
492
echo " GITSERVER $GITSERVER "
494
- cat $NETRCFILE
493
+ cat " $HOME /.netrc "
495
494
496
495
# prevent prompts on Windows particularly
497
496
export SSH_ASKPASS=
@@ -527,10 +526,10 @@ begin_test "credentials from netrc with bad password"
527
526
(
528
527
set -e
529
528
530
- printf " machine localhost\nlogin netrcuser\npassword badpass\n" >> " $NETRCFILE "
529
+ printf " machine localhost\nlogin netrcuser\npassword badpass\n" > " $HOME /.netrc "
531
530
echo $HOME
532
531
echo " GITSERVER $GITSERVER "
533
- cat $NETRCFILE
532
+ cat " $HOME /.netrc "
534
533
535
534
# prevent prompts on Windows particularly
536
535
export SSH_ASKPASS=
@@ -558,10 +557,10 @@ begin_test "credentials with bad netrc creds will retry"
558
557
(
559
558
set -e
560
559
561
- printf " machine localhost\nlogin netrcuser\npassword badpassretry\n" >> " $NETRCFILE "
560
+ printf " machine localhost\nlogin netrcuser\npassword badpassretry\n" > " $HOME /.netrc "
562
561
echo $HOME
563
562
echo " GITSERVER $GITSERVER "
564
- cat $NETRCFILE
563
+ cat " $HOME /.netrc "
565
564
566
565
# prevent prompts on Windows particularly
567
566
export SSH_ASKPASS=
0 commit comments